Part Number Hot Search : 
CXA1100P BAT54A 802M135B 27000 7950K11 TH71101 80C51 TDA7478D
Product Description
Full Text Search
 

To Download ADE7518 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  s i n g l e - p h a s e e n e r g y m e a s u r e m e n t i c w i t h 8 0 5 2 m c u , r t c , a n d l c d d r i v e r a d e 7 5 1 8 r e v . 0 i n f o r m a t i o n f u r n i s h e d b y a n a l o g d e v i c e s i s b e l i e v e d t o b e a c c u r a t e a n d r e l i a b l e . h o w e v e r , n o r e s p o n s i b i l i t y i s a s s u m e d b y a n a l o g d e v i c e s f o r i t s u s e , n o r f o r a n y i n f r i n g e m e n t s o f p a t e n t s o r o t h e r r i g h t s o f t h i r d p a r t i e s t h a t m a y r e s u l t f r o m i t s u s e . s p e c i f i c a t i o n s s u b j e c t t o c h a n g e w i t h o u t n o t i c e . n o l i c e n s e i s g r a n t e d b y i m p l i c a t i o n o r o t h e r w i s e u n d e r a n y p a t e n t o r p a t e n t r i g h t s o f a n a l o g d e v i c e s . t r a d e m a r k s a n d r e g i s t e r e d t r a d e m a r k s a r e t h e p r o p e r t y o f t h e i r r e s p e c t i v e o w n e r s . o n e t e c h n o l o g y w a y , p . o . b o x 9 1 0 6 , n o r w o o d , m a 0 2 0 6 2 - 9 1 0 6 , u . s . a . t e l : 7 8 1 . 3 2 9 . 4 7 0 0 w w w . a n a l o g . c o m f a x : 7 8 1 . 4 6 1 . 3 1 1 3 ? 2 0 0  a n a l o g d e v i c e s , i n c . a l l r i g h t s r e s e r v e d . g e n e r a l f e a t u r e s w i d e s u p p l y v o l t a g e o p e r a t i o n : 2 . 4 v t o 3 . 7 v i n t e r n a l b i p o l a r s w i t c h b e t w e e n r e g u l a t e d a n d b a t t e r y i n p u t s u l t r a l o w p o w e r o p e r a t i o n w i t h p o w e r s a v i n g m o d e s f u l l o p e r a t i o n : 4 m a t o 1 . 6 m a ( p l l c l o c k d e p e n d e n t ) b a t t e r y m o d e : 3 . 2 m a t o 4 0 0 a ( p l l c l o c k d e p e n d e n t ) s l e e p m o d e r e a l - t i m e c l o c k ( r t c ) m o d e : 1 . 5 a r t c a n d l c d m o d e : 2 7 a r e f e r e n c e : 1 . 2 v 0 . 1 % ( 1 0 p p m / c d r i f t ) 6 4 - l e a d r o h s p a c k a g e o p t i o n l o w p r o f i l e q u a d f l a t p a c k a g e ( l q f p ) o p e r a t i n g t e m p e r a t u r e r a n g e : ? 4 0 c t o + 8 5 c e n e r g y m e a s u r e m e n t f e a t u r e s p r o p r i e t a r y a n a l o g - t o - d i g i t a l c o n v e r t e r s ( a d c s ) a n d d i g i t a l s i g n a l p r o c e s s i n g ( d s p ) p r o v i d e h i g h a c c u r a c y a c t i v e ( w a t t ) , r e a c t i v e ( v a r ) , a n d a p p a r e n t e n e r g y ( v a ) m e a s u r e m e n t l e s s t h a n 0 . 1 % e r r o r o n a c t i v e e n e r g y o v e r a d y n a m i c r a n g e o f 1 0 0 0 t o 1 @ 2 5 c l e s s t h a n 0 . 5 % e r r o r o n r e a c t i v e e n e r g y o v e r a d y n a m i c r a n g e o f 1 0 0 0 t o 1 @ 2 5 c l e s s t h a n 0 . 5 % e r r o r o n r o o t m e a n s q u a r e ( r m s ) m e a s u r e m e n t s o v e r a d y n a m i c r a n g e o f 5 0 0 t o 1 f o r c u r r e n t ( i r m s ) a n d 1 0 0 t o 1 f o r v o l t a g e ( v r m s ) @ 2 5 c s u p p o r t s i e c 6 2 0 5 3 - 2 1 , i e c 6 2 0 5 3 - 2 2 , i e c 6 2 0 5 3 - 2 3 , e n 5 0 4 7 0 - 3 c l a s s a , c l a s s b , a n d c l a s s c , a n d a n s i c 1 2 - 1 6 d i f f e r e n t i a l i n p u t w i t h p r o g r a m m a b l e g a i n a m p l i f i e r s ( p g a s ) s u p p o r t s s h u n t s a n d c u r r e n t t r a n s f o r m e r s h i g h f r e q u e n c y o u t p u t s p r o p o r t i o n a l t o i r m s , a c t i v e , r e a c t i v e , o r a p p a r e n t p o w e r ( a p ) m i c r o p r o c e s s o r f e a t u r e s 8 0 5 2 - b a s e d c o r e s i n g l e - c y c l e 4 m i p s 8 0 5 2 c o r e 8 0 5 2 - c o m p a t i b l e i n s t r u c t i o n s e t 3 2 . 7 6 8 k h z e x t e r n a l c r y s t a l w i t h o n - c h i p p l l t w o e x t e r n a l i n t e r r u p t s o u r c e s e x t e r n a l r e s e t p i n l o w p o w e r b a t t e r y m o d e w a k e - u p f r o m i / o , a l a r m , a n d u n i v e r s a l a s y n c h r o n o u s r e c e i v e r / t r a n s m i t t e r ( u a r t ) l c d d r i v e r o p e r a t i o n r e a l - t i m e c l o c k c o u n t e r f o r s e c o n d s , m i n u t e s , a n d h o u r s a u t o m a t i c b a t t e r y s w i t c h o v e r f o r r t c b a c k u p o p e r a t i o n d o w n t o 2 . 4 v u l t r a l o w b a t t e r y s u p p l y c u r r e n t : 1 . 5 a s e l e c t a b l e o u t p u t f r e q u e n c y : 1 h z t o 1 6 . 3 8 4 k h z e m b e d d e d d i g i t a l c r y s t a l f r e q u e n c y c o m p e n s a t i o n f o r c a l i b r a t i o n a n d t e m p e r a t u r e v a r i a t i o n : 2 p p m r e s o l u t i o n i n t e g r a t e d l c d d r i v e r 1 0 8 - s e g m e n t d r i v e r 2 , 3 , o r 4 m u l t i p l e x i n g l c d v o l t a g e s g e n e r a t e d w i t h e x t e r n a l r e s i s t o r s o n - c h i p p e r i p h e r a l s u a r t , s p i o r i 2 c , a n d w a t c h d o g t i m e r p o w e r s u p p l y m a n a g e m e n t w i t h u s e r - s e l e c t a b l e l e v e l s m e m o r y : 1 6 k b f l a s h m e m o r y , 5 1 2 b y t e s r a m d e v e l o p m e n t t o o l s s i n g l e - p i n e m u l a t i o n i d e - b a s e d a s s e m b l y a n d c - s o u r c e d e b u g g i n g
a d e 7 5 1 8 r e v . 0 | p a g e 2 o f 1 2 8 t a b l e o f c o n t e n t s g e n e r a l f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1  e n e r g y m e a s u r e m e n t f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1  m i c r o p r o c e s s o r f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1  r e v i s i o n h i s t o r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3  g e n e r a l d e s c r i p t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4  f u n c t i o n a l b l o c k d i a g r a m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4  s p e c i f i c a t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5  e n e r g y m e t e r i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5  a n a l o g p e r i p h e r a l s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6  d i g i t a l i n t e r f a c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7  t i m i n g s p e c i f i c a t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9  a b s o l u t e m a x i m u m r a t i n g s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 4  t h e r m a l r e s i s t a n c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 4  e s d c a u t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 4  p i n c o n f i g u r a t i o n a n d f u n c t i o n d e s c r i p t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 5  t y p i c a l p e r f o r m a n c e c h a r a c t e r i s t i c s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 7  t e r m i n o l o g y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 0  s f r m a p p i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1  p o w e r m a n a g e m e n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2  p o w e r m a n a g e m e n t r e g i s t e r d e t a i l s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2  p o w e r s u p p l y a r c h i t e c t u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5  b a t t e r y s w i t c h o v e r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5  p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t . . . . . . . . . . . . . . . . . . . . . . . . . 2 6  u s i n g t h e p o w e r s u p p l y f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8  o p e r a t i n g m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0  p s m 0 ( n o r m a l m o d e ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0  p s m 1 ( b a t t e r y m o d e ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0  p s m 2 ( s l e e p m o d e ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0  3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1  t r a n s i t i o n i n g b e t w e e n o p e r a t i n g m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2  u s i n g t h e p o w e r m a n a g e m e n t f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2  e n e r g y m e a s u r e m e n t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3  a c c e s s t o e n e r g y m e a s u r e m e n t s f r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3  a c c e s s t o i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s . . . . . . . . . . . . . . . . 3 3  e n e r g y m e a s u r e m e n t r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 5  e n e r g y m e a s u r e m e n t i n t e r n a l r e g i s t e r s d e t a i l s . . . . . . . . . . . . . . . . . . . . 3 6  i n t e r r u p t s t a t u s / e n a b l e s f r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 8  a n a l o g i n p u t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 0  a n a l o g - t o - d i g i t a l c o n v e r s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1  p o w e r q u a l i t y m e a s u r e m e n t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4  p h a s e c o m p e n s a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 6  r m s c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 6  a c t i v e p o w e r c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 8  a c t i v e e n e r g y c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 0  r e a c t i v e p o w e r c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3  r e a c t i v e e n e r g y c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4  a p p a r e n t p o w e r c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8  a p p a r e n t e n e r g y c a l c u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 9  a m p e r e - h o u r a c c u m u l a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 0  e n e r g y - t o - f r e q u e n c y c o n v e r s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1  e n e r g y r e g i s t e r s c a l i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2  e n e r g y m e a s u r e m e n t i n t e r r u p t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2  8 0 5 2 m c u c o r e a r c h i t e c t u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3  m c u r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3  b a s i c 8 0 5 2 r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5  s t a n d a r d 8 0 5 2 s f r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6  m e m o r y o v e r v i e w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6  a d d r e s s i n g m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7  i n s t r u c t i o n s e t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 9  r e a d - m o d i f y - w r i t e i n s t r u c t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1  i n s t r u c t i o n s t h a t a f f e c t f l a g s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1  d u a l d a t a p o i n t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3  i n t e r r u p t s y s t e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4  s t a n d a r d 8 0 5 2 i n t e r r u p t a r c h i t e c t u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4  i n t e r r u p t a r c h i t e c t u r e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4  i n t e r r u p t r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4  i n t e r r u p t p r i o r i t y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5  i n t e r r u p t f l a g s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6  i n t e r r u p t v e c t o r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8  i n t e r r u p t l a t e n c y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8  c o n t e x t s a v i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8  w a t c h d o g t i m e r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 9  l c d d r i v e r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1  l c d r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1  l c d s e t u p . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  l c d t i m i n g a n d w a v e f o r m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4  b l i n k m o d e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5  d i s p l a y e l e m e n t c o n t r o l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5  l c d e x t e r n a l c i r c u i t r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6  l c d f u n c t i o n i n p s m 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6 
a d e 7 5 1 8 r e v . 0 | p a g e 3 o f 1 2 8 f l a s h m e m o r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 7  o v e r v i e w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 7  f l a s h m e m o r y o r g a n i z a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8  u s i n g t h e f l a s h m e m o r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8  p r o t e c t i n g t h e f l a s h m e m o r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1  i n - c i r c u i t p r o g r a m m i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2  t i m e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3  t i m e r r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3  t i m e r 0 a n d t i m e r 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5  t i m e r 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6  p l l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 8  p l l r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 8  r e a l - t i m e c l o c k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 0  r t c r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 0  r e a d a n d w r i t e o p e r a t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 3  r t c m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 3  r t c i n t e r r u p t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 3  r t c c a l i b r a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 4  u a r t s e r i a l i n t e r f a c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 5  u a r t r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 5  u a r t o p e r a t i o n m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 8  u a r t b a u d r a t e g e n e r a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 9  u a r t a d d i t i o n a l f e a t u r e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1  s e r i a l p e r i p h e r a l i n t e r f a c e ( s p i ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2  s p i r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2  s p i p i n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 5  s p i m a s t e r o p e r a t i n g m o d e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 6  s p i i n t e r r u p t a n d s t a t u s f l a g s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 7  i 2 c - c o m p a t i b l e i n t e r f a c e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 8  s e r i a l c l o c k g e n e r a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 8  s l a v e a d d r e s s e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 8  i 2 c r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 8  r e a d a n d w r i t e o p e r a t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 9  i 2 c r e c e i v e a n d t r a n s m i t f i f o s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 0  i / o p o r t s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 1  p a r a l l e l i / o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 1  i / o r e g i s t e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 2  p o r t 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 5  p o r t 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 5  p o r t 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 5  d e t e r m i n i n g t h e v e r s i o n o f t h e a d e 7 5 1 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 6  o u t l i n e d i m e n s i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 7  o r d e r i n g g u i d e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 7  r e v i s i o n h i s t o r y  / 0  ? r e v i s i o n 0 : i n i t i a l v e r s i o n
a d e 7 5 1 8 r e v . 0 | p a g e 4 o f 1 2 8 g e n e r a l d e s c r i p t i o n t h e a d e 7 5 1 8 1 i n t e g r a t e s t h e a n a l o g d e v i c e s , i n c . , e n e r g y ( a d e ) m e t e r i n g i c a n a l o g f r o n t e n d a n d f i x e d f u n c t i o n d s p s o l u t i o n w i t h a n e n h a n c e d 8 0 5 2 m c u c o r e , a n r t c , a n l c d d r i v e r , a n d a l l t h e p e r i p h e r a l s t o m a k e a n e l e c t r o n i c e n e r g y m e t e r w i t h a n l c d d i s p l a y i n a s i n g l e p a r t . t h e a d e m e a s u r e m e n t c o r e i n c l u d e s a c t i v e , r e a c t i v e , a n d a p p a r e n t e n e r g y c a l c u l a t i o n s , a s w e l l a s v o l t a g e a n d c u r r e n t r m s m e a s u r e - m e n t s . t h i s i n f o r m a t i o n i s r e a d y t o u s e f o r e n e r g y b i l l i n g b y u s i n g b u i l t - i n e n e r g y s c a l a r s . m a n y p o w e r l i n e s u p e r v i s o r y f e a t u r e s , s u c h a s s a g , p e a k , a n d z e r o c r o s s i n g , a r e i n c l u d e d i n t h e e n e r g y m e a s u r e m e n t d s p t o s i m p l i f y e n e r g y m e t e r d e s i g n . t h e m i c r o p r o c e s s o r f u n c t i o n a l i t y i n c l u d e s a s i n g l e - c y c l e 8 0 5 2 c o r e , a r e a l - t i m e c l o c k w i t h a p o w e r s u p p l y b a c k u p p i n , a u a r t , a n d a n s p i o r i 2 c ? i n t e r f a c e . t h e r e a d y - t o - u s e i n f o r m a t i o n f r o m t h e a d e c o r e r e d u c e s t h e p r o g r a m m e m o r y s i z e r e q u i r e m e n t , m a k i n g i t e a s y t o i n t e g r a t e c o m p l i c a t e d d e s i g n i n t o 1 6 k b o f f l a s h m e m o r y . t h e a d e 7 5 1 8 a l s o i n c l u d e s a 1 0 8 - s e g m e n t l c d d r i v e r . t h i s d r i v e r g e n e r a t e s w a v e f o r m s c a p a b l e o f d r i v i n g l c d s u p t o 3 . 3 v . f u n c t i o n a l b l o c k d i a g r a m i p i n v p v n r e f i n / o u t e n e r g y m e a s u r e m e n t d s p o s c c o m 0 . . . . . . c o m 3 . . . c f 1 c f 2 l d o l c d l e v e l s s i n g l e c y c l e 8 0 5 2 m c u a d e 7 5 1 8 f p 2 6 v d c i n v b a t v d d v s w o u t v i n t d v i n t a r e s e t d g n d a g n d t x d u a r t s e r i a l p o r t l c d v a l c d v b l c d v c . . . f p 0 f p 1 5 r t c s s s c l k m i s o m o s i / s d a t a r x d s d e n t 2 t 2 e x t 0 t 1 l c d v p 1 l c d v p 2 x t a l 2 x t a l 1 i n t 0 i n t 1 f p 1 6 f p 1 7 f p 2 3 f p 2 2 f p 2 1 f p 2 0 f p 1 9 f p 1 8 f p 2 5 f p 2 4 p 0 . 7 ( s s / t 1 ) p 0 . 6 ( s c l k / t 0 ) p 0 . 5 ( m i s o ) p 0 . 4 ( m o s i / s d a t a ) p 0 . 0 ( b c t r l / i n t 1 ) p 1 . 0 ( r x d ) p 1 . 1 ( t x d ) p 1 . 2 ( f p 2 5 ) p 1 . 3 ( t 2 e x / f p 2 4 ) p 1 . 6 ( f p 2 1 ) p 1 . 7 ( f p 2 0 ) p 1 . 4 ( t 2 / f p 2 3 ) p 1 . 5 ( f p 2 2 ) p 2 . 0 ( f p 1 8 ) p 2 . 1 ( f p 1 7 ) p 2 . 2 ( f p 1 6 ) p 2 . 3 ( s d e n ) p 0 . 1 ( f p 1 9 ) p 0 . 2 ( c f 1 / r t c c a l ) p 0 . 3 ( c f 2 ) 1 . 2 0 v r e f 5 2 5 3 5 5 4 9 5 0 6 3 5 4 5 8 6 4 6 1 6 0 6 2 5 6 5 1 4 4 3 6 3 7 4 6 4 7 4 8 4 5 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 2 0 3 5 1 4 1 5 1 7 1 8 1 6 1 9 4 4 1 4 1 3 1 2 5 7 4 3 4 2 3 9 3 8 7 6 4 5 1 1 4 3 4 2 4 1 4 0 3 9 3 8 3 7 3 6 5 6 7 8 9 1 0 3 8 3 9 4 0 4 1 5 9 p g a 2 ? + p g a 1 ? + a d c a d c p r o g r a m m e m o r y 1 6 k b f l a s h p o w e r s u p p l y c o n t r o l a n d m o n i t o r i n g u s e r r a m 2 5 6 b y t e s u s e r x r a m 2 5 6 b y t e s s p i / i 2 c s e r i a l i n t e r f a c e 3 1 6 - b i t c o u n t e r t i m e r s 1 0 8 - s e g m e n t l c d d r i v e r w a t c h d o g t i m e r d o w n l o a d e r d e b u g g e r p l l 1 - p i n e m u l a t o r l d o e a u a r t t i m e r p o r 0 7 3 2 7 - 0 0 1 f i g u r e 1 . 1 p a t e n t s p e n d i n g .
a d e 7 5 1 8 r e v . 0 | p a g e 5 o f 1 2 8 s p e c i f i c a t i o n s v d d = 3 . 3 v 5 % , a g n d = d g n d = 0 v , o n - c h i p r e f e r e n c e x t a l = 3 2 . 7 6 8 k h z , t m i n t o t m a x = ? 4 0 c t o + 8 5 c , u n l e s s o t h e r w i s e n o t e d . e n e r g y m e t e r i n g t a b l e 1 . p a r a m e t e r m i n t y p m a x u n i t t e s t c o n d i t i o n s / c o m m e n t s m e a s u r e m e n t a c c u r a c y 1 p h a s e e r r o r b e t w e e n c h a n n e l s p f = 0 . 8 c a p a c i t i v e 0 . 0 5 d e g r e e s 3 7 p h a s e l e a d p f = 0 . 5 i n d u c t i v e 0 . 0 5 d e g r e e s 6 0 p h a s e l a g a c t i v e e n e r g y m e a s u r e m e n t e r r o r 2 0 . 1 % o f r e a d i n g o v e r a d y n a m i c r a n g e o f 1 0 0 0 t o 1 @ 2 5 c a c p o w e r s u p p l y r e j e c t i o n 2 v d d = 3 . 3 v + 1 0 0 m v r m s / 1 2 0 h z o u t p u t f r e q u e n c y v a r i a t i o n 0 . 0 1 % i p = v p = 1 0 0 m v r m s d c p o w e r s u p p l y r e j e c t i o n 2 v d d = 3 . 3 v 1 1 7 m v d c o u t p u t f r e q u e n c y v a r i a t i o n 0 . 0 1 % a c t i v e e n e r g y m e a s u r e m e n t b a n d w i d t h 1 8 k h z r e a c t i v e e n e r g y m e a s u r e m e n t e r r o r 2 0 . 5 % o f r e a d i n g o v e r a d y n a m i c r a n g e o f 1 0 0 0 t o 1 @ 2 5 c v r m s m e a s u r e m e n t e r r o r 2 0 . 5 % o f r e a d i n g o v e r a d y n a m i c r a n g e o f 1 0 0 t o 1 @ 2 5 c v r m s m e a s u r e m e n t b a n d w i d t h 1 3 . 9 k h z i r m s m e a s u r e m e n t e r r o r 2 0 . 5 % o f r e a d i n g o v e r a d y n a m i c r a n g e o f 5 0 0 t o 1 @ 2 5 c i r m s m e a s u r e m e n t b a n d w i d t h 1 3 . 9 k h z a n a l o g i n p u t s m a x i m u m s i g n a l l e v e l s 4 0 0 m v p e a k v p ? v n d i f f e r e n t i a l i n p u t 4 0 0 m v p e a k i p ? i n d i f f e r e n t i a l i n p u t i n p u t i m p e d a n c e ( d c ) 7 7 0 k  a d c o f f s e t e r r o r 2 1 0 m v p g a 1 = p g a 2 = 1 1 m v p g a 1 = 1 6 g a i n e r r o r 2 c u r r e n t c h a n n e l ? 3 + 3 % i p = 0 . 4 v d c o r i p = 0 . 4 d c v o l t a g e c h a n n e l ? 3 + 3 % v o l t a g e c h a n n e l = 0 . 4 v d c g a i n e r r o r m a t c h 0 . 2 % c f 1 a n d c f 2 p u l s e o u t p u t m a x i m u m o u t p u t f r e q u e n c y 1 3 . 5 k h z v p ? v n = 4 0 0 m v p e a k , i p ? i n = 2 5 0 m v , p g a 1 = 2 s i n e w a v e d u t y c y c l e 5 0 % i f c f 1 o r c f 2 f r e q u e n c y , > 5 . 5 5 h z a c t i v e h i g h p u l s e w i d t h 9 0 m s i f c f 1 o r c f 2 f r e q u e n c y , < 5 . 5 5 h z 1 t h e s e s p e c i f i c a t i o n s a r e n o t p r o d u c t i o n t e s t e d b u t a r e g u a r a n t e e d b y d e s i g n a n d / o r c h a r a c t e r i z a t i o n d a t a o n p r o d u c t i o n r e l e a s e . 2 s e e t h e t e r m i n o l o g y s e c t i o n f o r d e f i n i t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 6 o f 1 2 8 a n a l o g p e r i p h e r a l s t a b l e 2 . p a r a m e t e r m i n t y p m a x u n i t t e s t c o n d i t i o n s / c o m m e n t s p o w e r - o n r e s e t ( p o r ) v d d p o r d e t e c t i o n t h r e s h o l d 2 . 5 2 . 9 5 v p o r a c t i v e t i m e o u t p e r i o d 3 3 m s v s w o u t p o r d e t e c t i o n t h r e s h o l d 1 . 8 2 . 2 v p o r a c t i v e t i m e o u t p e r i o d 2 0 m s v i n t d p o r d e t e c t i o n t h r e s h o l d 2 . 0 3 2 . 2 2 v p o r a c t i v e t i m e o u t p e r i o d 1 6 m s v i n t a p o r d e t e c t i o n t h r e s h o l d 2 . 0 5 2 . 1 5 v p o r a c t i v e t i m e o u t p e r i o d 1 2 0 m s b a t t e r y s w i t c h o v e r v o l t a g e o p e r a t i n g r a n g e ( v s w o u t ) 2 . 4 3 . 7 v v d d t o v b a t s w i t c h i n g s w i t c h i n g t h r e s h o l d ( v d d ) 2 . 5 2 . 9 5 v s w i t c h i n g d e l a y 1 0 n s w h e n v d d t o v b a t s w i t c h a c t i v a t e d b y v d d 3 0 m s w h e n v d d t o v b a t s w i t c h a c t i v a t e d b y v d c i n v b a t t o v d d s w i t c h i n g s w i t c h i n g t h r e s h o l d ( v d d ) 2 . 5 2 . 9 5 v s w i t c h i n g d e l a y 3 0 m s b a s e d o n v d d > 2 . 7 5 v v s w o u t t o v b a t l e a k a g e c u r r e n t 1 0 n a v b a t = 0 v , v s w o u t = 3 . 4 3 v , t a = 2 5 c l c d , r e s i s t o r l a d d e r a c t i v e l e a k a g e c u r r e n t 2 0 n a 1 / 2 a n d 1 / 3 b i a s m o d e s , n o l o a d v 1 s e g m e n t l i n e v o l t a g e l c d v a ? 0 . 1 l c d v a v c u r r e n t o n s e g m e n t l i n e = ? 2 a v 2 s e g m e n t l i n e v o l t a g e l c d v b ? 0 . 1 l c d v b v c u r r e n t o n s e g m e n t l i n e = ? 2 a v 3 s e g m e n t l i n e v o l t a g e l c d v c ? 0 . 1 l c d v c v c u r r e n t o n s e g m e n t l i n e = ? 2 a o n - c h i p r e f e r e n c e r e f e r e n c e e r r o r 0 . 9 m v t a = 2 5 c p o w e r s u p p l y r e j e c t i o n 8 0 d b t e m p e r a t u r e c o e f f i c i e n t 1 0 5 0 p p m / c
a d e 7 5 1 8 r e v . 0 | p a g e 7 o f 1 2 8 d i g i t a l i n t e r f a c e t a b l e 3 . p a r a m e t e r m i n t y p m a x u n i t t e s t c o n d i t i o n s / c o m m e n t s l o g i c i n p u t s a l l i n p u t s e x c e p t x t a l 1 , x t a l 2 , b c t r l , i n t 0 , i n t 1 , r e s e t i n p u t h i g h v o l t a g e , v i n h 2 . 0 v i n p u t l o w v o l t a g e , v i n l 0 . 4 v b c t r l , i n t 0 , i n t 1 , r e s e t i n p u t h i g h v o l t a g e , v i n h 1 . 3 v i n p u t l o w v o l t a g e , v i n l 0 . 4 v i n p u t c u r r e n t s r e s e t 1 0 0 n a r e s e t = v s w o u t = 3 . 3 v p o r t 0 , p o r t 1 , p o r t 2 1 0 0 n a i n t e r n a l p u l l - u p d i s a b l e d , i n p u t = 0 v o r v s w o u t ? 3 . 7 5 ? 8 . 5 a i n t e r n a l p u l l - u p e n a b l e d , i n p u t = 0 v , v s w o u t = 3 . 3 v i n p u t c a p a c i t a n c e 1 0 p f a l l d i g i t a l i n p u t s f l a s h m e m o r y e n d u r a n c e 1 1 0 , 0 0 0 c y c l e s d a t a r e t e n t i o n 2 2 0 y e a r s t j = 8 5 c c r y s t a l o s c i l l a t o r c r y s t a l e q u i v a l e n t s e r i e s r e s i s t a n c e 3 0 5 0 k  c r y s t a l f r e q u e n c y 3 2 3 2 . 7 6 8 3 3 . 5 k h z x t a l 1 i n p u t c a p a c i t a n c e 1 2 p f x t a l 2 o u t p u t c a p a c i t a n c e 1 2 p f m c u c l o c k r a t e ( f c o r e ) 4 . 0 9 6 m h z c r y s t a l = 3 2 . 7 6 8 k h z a n d c d [ 2 : 0 ] = 0 b 0 0 0 3 2 k h z c r y s t a l = 3 2 . 7 6 8 k h z a n d c d [ 2 : 0 ] = 0 b 1 1 1 l o g i c o u t p u t s o u t p u t h i g h v o l t a g e , v o h 2 . 4 v v d d = 3 . 3 v 5 % i s o u r c e 8 0 a  o u t p u t l o w v o l t a g e , v o l 3 0 . 4 v v d d = 3 . 3 v 5 % i s i n k 2 m a s t a r t - u p t i m e 4 p s m 0 p o w e r - o n t i m e 4 4 8 m s v d d a t 2 . 7 5 v t o p s m 0 c o d e e x e c u t i o n f r o m p o w e r s a v i n g m o d e 1 ( p s m 1 )  p s m 1 : p s m 0 1 3 0  m s v d d a t 2 . 7 5 v t o p s m 0 c o d e e x e c u t i o n f r o m p o w e r s a v i n g m o d e 2 ( p s m 2 )  p s m 2 : p s m 1 4 8  m s w a k e - u p e v e n t t o p s m 1 c o d e e x e c u t i o n p s m 2 : p s m 0 1 8 6  m s v d d a t 2 . 7 5 v t o p s m 0 c o d e e x e c u t i o n p o w e r s u p p l y i n p u t s v d d 3 . 1 3 3 . 3 3 . 4 6 v v b a t 2 . 4 3 . 3 3 . 7 v i n t e r n a l p o w e r s u p p l y s w i t c h ( v s w o u t ) v b a t t o v s w o u t o n r e s i s t a n c e 2 2  v b a t = 2 . 4 v v d d t o v s w o u t o n r e s i s t a n c e 1 0 . 2  v d d = 3 . 1 3 v v b a t 8: v d d s w i t c h i n g o p e n t i m e 4 0 n s b c t r l s t a t e c h a n g e a n d s w i t c h d e l a y 1 8 s v s w o u t o u t p u t c u r r e n t d r i v e 1 6 m a p o w e r s u p p l y o u t p u t s v i n t a 2 . 2 5 2 . 7 5 v v i n t d 2 . 3 2 . 7 0 v v i n t a p o w e r s u p p l y r e j e c t i o n 6 0 d b v i n t d p o w e r s u p p l y r e j e c t i o n 5 0 d b
a d e 7 5 1 8 r e v . 0 | p a g e 8 o f 1 2 8 p a r a m e t e r m i n t y p m a x u n i t t e s t c o n d i t i o n s / c o m m e n t s p o w e r s u p p l y c u r r e n t s c u r r e n t i n n o r m a l m o d e ( p s m 0 ) 4 5 . 3 m a f c o r e = 4 . 0 9 6 m h z , l c d a n d m e t e r a c t i v e 2 . 1 m a f c o r e = 1 . 0 2 4 m h z , l c d a n d m e t e r a c t i v e 1 . 6 m a f c o r e = 3 2 . 7 6 8 k h z , l c d a n d m e t e r a c t i v e 3 . 2 4 . 2 5 m a f c o r e = 4 . 0 9 6 m h z , m e t e r d s p a c t i v e , m e t e r i n g a d c p o w e r e d d o w n 3 3 . 9 m a f c o r e = 4 . 0 9 6 m h z , m e t e r i n g a d c a n d d s p p o w e r e d d o w n c u r r e n t i n p s m 1 3 . 2 5 . 0 5 m a f c o r e = 4 . 0 9 6 m h z , l c d a c t i v e , v b a t = 3 . 7 v 8 8 0 a f c o r e = 1 . 0 2 4 m h z , l c d a c t i v e c u r r e n t i n p s m 2 3 8 a l c d a c t i v e a t 3 . 3 v + r t c ( r e a l - t i m e c l o c k ) 1 . 5 a r t c o n l y , t a = 2 5 c , v b a t = 3 . 3 v p o w e r s u p p l y c u r r e n t s c u r r e n t i n n o r m a l m o d e ( p s m 0 ) 4 5 . 3 m a f c o r e = 4 . 0 9 6 m h z , l c d a n d m e t e r a c t i v e 1 e n d u r a n c e i s q u a l i f i e d a s p e r j e d e c s t a n d a r d 2 2 m e t h o d a 1 1 7 a n d m e a s u r e d a t ? 4 0 c , + 2 5 c , + 8 5 c , a n d + 1 2 5 c . 2 r e t e n t i o n l i f e t i m e e q u i v a l e n t a t j u n c t i o n t e m p e r a t u r e ( t j ) = 8 5 c a s p e r j e d e c s t a n d a r d 2 2 m e t h o d a 1 1 7 . r e t e n t i o n l i f e t i m e d e r a t e s w i t h j u n c t i o n t e m p e r a t u r e . 3 t e s t p e r f o r m e d w i t h a l l t h e i / o s s e t t o a l o w o u t p u t l e v e l . 4 d e l a y b e t w e e n p o w e r s u p p l y v a l i d a n d e x e c u t i o n o f f i r s t i n s t r u c t i o n b y 8 0 5 2 c o r e .
a d e 7 5 1 8 r e v . 0 | p a g e 9 o f 1 2 8 t i m i n g s p e c i f i c a t i o n s a c i n p u t s d u r i n g t e s t i n g w e r e d r i v e n a t v s w o u t ? 0 . 5 v f o r l o g i c 1 a n d 0 . 4 5 v f o r l o g i c 0 . t i m i n g m e a s u r e m e n t s w e r e m a d e a t v i h m i n i m u m f o r l o g i c 1 a n d v i l m a x i m u m f o r l o g i c 0 , a s s h o w n i n f i g u r e 2 . f o r t i m i n g p u r p o s e s , a p o r t p i n i s n o l o n g e r f l o a t i n g w h e n a 1 0 0 m v c h a n g e f r o m l o a d v o l t a g e o c c u r s . a p o r t p i n b e g i n s t o f l o a t w h e n a 1 0 0 m v c h a n g e f r o m t h e l o a d e d v o h / v o l l e v e l o c c u r s , a s s h o w n i n f i g u r e 2 . f o r t a b l e 4 t o t a b l e 9 , c l o a d = 8 0 p f f o r a l l o u t p u t s , v d d = 2 . 7 v t o 3 . 6 v , a n d a l l s p e c i f i c a t i o n s t m i n t o t m a x , u n l e s s o t h e r w i s e n o t e d . v s w o u t ? 0 . 5 v 0 . 4 5 v 0 . 2 v s w o u t + 0 . 9 v t e s t p o i n t s 0 . 2 v s w o u t ? 0 . 1 v v l o a d ? 0 . 1 v v l o a d v l o a d + 0 . 1 v t i m i n g r e f e r e n c e p o i n t s v l o a d ? 0 . 1 v v l o a d v l o a d ? 0 . 1 v 0 7 3 2 7 - 0 0 2 f i g u r e 2 . t i m i n g w a v e f o r m c h a r a c t e r i s t i c s t a b l e 4 . c l o c k i n p u t ( e x t e r n a l c l o c k d r i v e n x t a l 1 ) p a r a m e t e r s 3 2 . 7 6 8 k h z e x t e r n a l c r y s t a l p a r a m e t e r d e s c r i p t i o n m i n t y p m a x u n i t t c k x t a l 1 p e r i o d 3 0 . 5 2 s t c k l x t a l 1 w i d t h l o w 6 . 2 6 s t c k h x t a l 1 w i d t h h i g h 6 . 2 6 s t c k r x t a l 1 r i s e t i m e 9 n s t c k f x t a l 1 f a l l t i m e 9 n s 1 / t c o r e c o r e c l o c k f r e q u e n c y 1 0 . 0 3 2 7 6 8 1 . 0 2 4 4 . 0 9 6 m h z 1 t h e a d e 7 5 1 8 i n t e r n a l p l l l o c k s o n t o a m u l t i p l e ( 5 1 2 t i m e s ) o f t h e 3 2 . 7 6 8 k h z e x t e r n a l c r y s t a l f r e q u e n c y t o p r o v i d e a s t a b l e 4 . 0 9 6 m h z i n t e r n a l c l o c k f o r t h e s y s t e m . t h e c o r e c a n o p e r a t e a t t h i s f r e q u e n c y o r a t a b i n a r y s u b m u l t i p l e d e f i n e d b y t h e c d [ 2 : 0 ] b i t s , s e l e c t e d v i a t h e p o w c o n s f r ( s e e t a b l e 2 4 ) . t a b l e 5 . i 2 c - c o m p a t i b l e i n t e r f a c e t i m i n g p a r a m e t e r s ( 4 0 0 k h z ) p a r a m e t e r d e s c r i p t i o n t y p u n i t t b u f b u s - f r e e t i m e b e t w e e n s t o p c o n d i t i o n a n d s t a r t c o n d i t i o n 1 . 3 s t l s c l k l o w p u l s e w i d t h 1 . 3 6 s t h s c l k h i g h p u l s e w i d t h 1 . 1 4 s t s h d s t a r t c o n d i t i o n h o l d t i m e 2 5 1 . 3 5 s t d s u d a t a s e t u p t i m e 7 4 0 n s t d h d d a t a h o l d t i m e 4 0 0 n s t r s u s e t u p t i m e f o r r e p e a t e d s t a r t 1 2 . 5 n s t p s u s t o p c o n d i t i o n s e t u p t i m e 4 0 0 n s t r r i s e t i m e o f b o t h s c l k a n d s d a t a 2 0 0 n s t f f a l l t i m e o f b o t h s c l k a n d s d a t a 3 0 0 n s t s u p 1 p u l s e w i d t h o f s p i k e s u p p r e s s e d 5 0 n s 1 i n p u t f i l t e r i n g o n b o t h t h e s c l k a n d s d a t a i n p u t s s u p p r e s s e s n o i s e s p i k e s o f l e s s t h a n 5 0 n s . m s b t b u f s d a t a ( i / o ) s c l k ( i ) s t o p c o n d i t i o n s t a r t c o n d i t i o n r e p e a t e d s t a r t l s b a c k m s b 1 2 t o 7 8 9 1 s ( r ) p s t p s u t d s u t s h d t d h d t s u p t d s u t d h d t h t s u p t l t r s u t r t r t f t f 0 7 3 2 7 - 0 0 3 f i g u r e 3 . i 2 c - c o m p a t i b l e i n t e r f a c e t i m i n g
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 o f 1 2 8 t a b l e 6 . s p i m a s t e r m o d e t i m i n g ( s p i c p h a = 1 ) p a r a m e t e r s p a r a m e t e r d e s c r i p t i o n m i n t y p m a x u n i t t s l s c l k l o w p u l s e w i d t h 2 s p i r t c o r e 1 n s t s h s c l k h i g h p u l s e w i d t h 2 s p i r t c o r e 1 n s t d a v d a t a o u t p u t v a l i d a f t e r s c l k e d g e 3 t c o r e 1 n s t d s u d a t a i n p u t s e t u p t i m e b e f o r e s c l k e d g e 0 n s t d h d d a t a i n p u t h o l d t i m e a f t e r s c l k e d g e t c o r e 1 n s t d f d a t a o u t p u t f a l l t i m e 1 9 n s t d r d a t a o u t p u t r i s e t i m e 1 9 n s t s r s c l k r i s e t i m e 1 9 n s t s f s c l k f a l l t i m e 1 9 n s 1 t c o r e d e p e n d s o n t h e c l o c k d i v i d e r o r c d [ 2 : 0 ] b i t s o f t h e p o w c o n s f r ( s e e t a b l e 2 4 ) ; t c o r e = 2 c d / 4 . 0 9 6 m h z . s c l k ( s p i c p o l = 0 ) t d s u s c l k ( s p i c p o l = 1 ) m o s i m i s o m s b l s b l s b i n b i t s [ 6 : 1 ] b i t s [ 6 : 1 ] t d h d t d r t d a v t d f t s h t s l t s r t s f m s b i n 0 7 3 2 7 - 0 0 4 f i g u r e 4 . s p i m a s t e r m o d e t i m i n g ( s p i c p h a = 1 )
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 o f 1 2 8 t a b l e 7 . s p i m a s t e r m o d e t i m i n g ( s p i c p h a = 0 ) p a r a m e t e r s p a r a m e t e r d e s c r i p t i o n m i n t y p m a x u n i t t s l s c l k l o w p u l s e w i d t h 2 s p i r t c o r e 1 ( s p i r + 1 ) t c o r e 1 n s t s h s c l k h i g h p u l s e w i d t h 2 s p i r t c o r e 1 ( s p i r + 1 ) t c o r e 1 n s t d a v d a t a o u t p u t v a l i d a f t e r s c l k e d g e 3 t c o r e 1 n s t d o s u d a t a o u t p u t s e t u p b e f o r e s c l k e d g e 7 5 n s t d s u d a t a i n p u t s e t u p t i m e b e f o r e s c l k e d g e 0 n s t d h d d a t a i n p u t h o l d t i m e a f t e r s c l k e d g e t c o r e 1 n s t d f d a t a o u t p u t f a l l t i m e 1 9 n s t d r d a t a o u t p u t r i s e t i m e 1 9 n s t s r s c l k r i s e t i m e 1 9 n s t s f s c l k f a l l t i m e 1 9 n s 1 t c o r e d e p e n d s o n t h e c l o c k d i v i d e r o r c d [ 2 : 0 ] b i t s o f t h e p o w c o n s f r ( s e e t a b l e 2 4 ) ; t c o r e = 2 c d / 4 . 0 9 6 m h z . s c l k ( s p i c p o l = 0 ) t d s u s c l k ( s p i c p o l = 1 ) m o s i m i s o m s b l s b l s b i n b i t s [ 6 : 1 ] b i t s [ 6 : 1 ] t d h d t d r t d a v t d f t d o s u t s h t s l t s r t s f m s b i n 0 7 3 2 7 - 0 0 5 f i g u r e 5 . s p i m a s t e r m o d e t i m i n g ( s p i c p h a = 0 )
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 o f 1 2 8 t a b l e 8 . s p i s l a v e m o d e t i m i n g ( s p i c p h a = 1 ) p a r a m e t e r s p a r a m e t e r d e s c r i p t i o n m i n t y p m a x u n i t t s s s s t o s c l k e d g e 1 4 5 n s t s l s c l k l o w p u l s e w i d t h 6 t c o r e 1 n s t s h s c l k h i g h p u l s e w i d t h 6 t c o r e 1 n s t d a v d a t a o u t p u t v a l i d a f t e r s c l k e d g e 2 5 n s t d s u d a t a i n p u t s e t u p t i m e b e f o r e s c l k e d g e 0 n s t d h d d a t a i n p u t h o l d t i m e a f t e r s c l k e d g e 2 t c o r e 1 + 0 . 5 s t d f d a t a o u t p u t f a l l t i m e 1 9 n s t d r d a t a o u t p u t r i s e t i m e 1 9 n s t s r s c l k r i s e t i m e 1 9 n s t s f s c l k f a l l t i m e 1 9 n s t s f s s s h i g h a f t e r s c l k e d g e 0 n s 1 t c o r e d e p e n d s o n t h e c l o c k d i v i d e r o r c d [ 2 : 0 ] b i t s o f t h e p o w c o n s f r ( s e e t a b l e 2 4 ) ; t c o r e = 2 c d / 4 . 0 9 6 m h z . m s b m o s i b i t s [ 6 : 1 ] t d h d t d s u m s b i n l s b i n b i t s [ 6 : 1 ] l s b t d r t d f t d a v m i s o t s l t s h t s r t s f t s f s t s s s c l k ( s p i c p o l = 1 ) s c l k ( s p i c p o l = 0 ) s s 0 7 3 2 7 - 0 0 6 f i g u r e 6 . s p i s l a v e m o d e t i m i n g ( s p i c p h a = 1 )
a d e 7 5 1 8 r e v . 0 | p a g e 1 3 o f 1 2 8 t a b l e 9 . s p i s l a v e m o d e t i m i n g ( s p i c p h a = 0 ) p a r a m e t e r s p a r a m e t e r d e s c r i p t i o n m i n t y p m a x u n i t t s s s s t o s c l k e d g e 1 4 5 n s t s l s c l k l o w p u l s e w i d t h 6 t c o r e 1 n s t s h s c l k h i g h p u l s e w i d t h 6 t c o r e 1 n s t d a v d a t a o u t p u t v a l i d a f t e r s c l k e d g e 2 5 n s t d s u d a t a i n p u t s e t u p t i m e b e f o r e s c l k e d g e 0 n s t d h d d a t a i n p u t h o l d t i m e a f t e r s c l k e d g e 2 t c o r e 1 + 0 . 5 s t d f d a t a o u t p u t f a l l t i m e 1 9 n s t d r d a t a o u t p u t r i s e t i m e 1 9 n s t s r s c l k r i s e t i m e 1 9 n s t s f s c l k f a l l t i m e 1 9 n s t d o s s d a t a o u t p u t v a l i d a f t e r s s e d g e 0 n s t s f s s s h i g h a f t e r s c l k e d g e 0 n s 1 t c o r e d e p e n d s o n t h e c l o c k d i v i d e r o r c d [ 2 : 0 ] b i t s o f t h e p o w c o n s f r ( s e e t a b l e 2 4 ) ; t c o r e = 2 c d / 4 . 0 9 6 m h z . m s b m o s i b i t s [ 6 : 1 ] t d h d t d s u l s b i n b i t s [ 6 : 1 ] l s b t d r t d f t d a v m i s o t s r t s f t s f s t s s s c l k ( s p i c p o l = 1 ) s c l k ( s p i c p o l = 0 ) s s t s h t s l t d o s s m s b i n 0 7 3 2 7 - 0 0 7 f i g u r e 7 . s p i s l a v e m o d e t i m i n g ( s p i c p h a = 0 )
a d e 7 5 1 8 r e v . 0 | p a g e 1 4 o f 1 2 8 a b s o l u t e m a x i m u m r a t i n g s t a = 2 5 c , u n l e s s o t h e r w i s e n o t e d . t a b l e 1 0 . p a r a m e t e r r a t i n g v d d t o d g n d ? 0 . 3 v t o + 3 . 7 v v b a t t o d g n d ? 0 . 3 v t o + 3 . 7 v v d c i n t o d g n d ? 0 . 3 v t o v s w o u t + 0 . 3 v i n p u t l c d v o l t a g e t o a g n d , l c d v a , l c d v b , l c d v c 1 ? 0 . 3 v t o v s w o u t + 0 . 3 v a n a l o g i n p u t v o l t a g e t o a g n d , v p , v n , i p , a n d i n ? 2 v t o + 2 v d i g i t a l i n p u t v o l t a g e t o d g n d ? 0 . 3 v t o v s w o u t + 0 . 3 v d i g i t a l o u t p u t v o l t a g e t o d g n d ? 0 . 3 v t o v s w o u t + 0 . 3 v o p e r a t i n g t e m p e r a t u r e r a n g e ( i n d u s t r i a l ) ? 4 0 c t o + 8 5 c s t o r a g e t e m p e r a t u r e r a n g e ? 6 5 c t o + 1 5 0 c 6 4 - l e a d l q f p , p o w e r d i s s i p a t i o n 1 w l e a d t e m p e r a t u r e s o l d e r i n g 3 0 0 c t i m e 3 0 s e c 1 w h e n u s e d w i t h e x t e r n a l r e s i s t o r d i v i d e r . s t r e s s e s a b o v e t h o s e l i s t e d u n d e r a b s o l u t e m a x i m u m r a t i n g s m a y c a u s e p e r m a n e n t d a m a g e t o t h e d e v i c e . t h i s i s a s t r e s s r a t i n g o n l y ; f u n c t i o n a l o p e r a t i o n o f t h e d e v i c e a t t h e s e o r a n y o t h e r c o n d i t i o n s a b o v e t h o s e i n d i c a t e d i n t h e o p e r a t i o n a l s e c t i o n o f t h i s s p e c i f i c a t i o n i s n o t i m p l i e d . e x p o s u r e t o a b s o l u t e m a x i m u m r a t i n g c o n d i t i o n s f o r e x t e n d e d p e r i o d s m a y a f f e c t d e v i c e r e l i a b i l i t y . t h e r m a l r e s i s t a n c e  j a i s s p e c i f i e d f o r t h e w o r s t - c a s e c o n d i t i o n s , t h a t i s , a d e v i c e s o l d e r e d i n a c i r c u i t b o a r d f o r s u r f a c e - m o u n t p a c k a g e s . t a b l e 1 1 . t h e r m a l r e s i s t a n c e p a c k a g e t y p e  j a  j c u n i t 6 4 - l e a d l q f p 6 0 2 0 . 5 c / w e s d c a u t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 1 5 o f 1 2 8 p i n c o n f i g u r a t i o n a n d f u n c t i o n d e s c r i p t i o n s 6 4 v d c i n 6 3 d g n d 6 2 v i n t d 6 1 v s w o u t 6 0 v d d 5 9 v i n t a 5 8 v b a t 5 7 r e f i n / o u t 5 6 f p 2 6 5 5 r e s e t 5 4 a g n d 5 3 i n 5 2 i p 5 1 e a 5 0 v n 4 9 v p 4 7 x t a l 1 4 6 x t a l 2 4 5 b c t r l / i n t 1 / p 0 . 0 4 2 p 0 . 3 / c f 2 4 3 p 0 . 2 / c f 1 / r t c c a l 4 4 s d e n / p 2 . 3 4 8 i n t 0 4 1 p 0 . 4 / m o s i / s d a t a 4 0 p 0 . 5 / m i s o 3 9 p 0 . 6 / s c l k / t 0 3 7 p 1 . 0 / r x d 3 6 p 1 . 1 / t x d 3 5 f p 0 3 4 f p 1 3 3 f p 2 3 8 p 0 . 7 / s s / t 1 2 c o m 2 / f p 2 8 3 c o m 1 4 c o m 0 7 p 1 . 4 / t 2 / f p 2 3 6 p 1 . 3 / t 2 e x / f p 2 4 5 p 1 . 2 / f p 2 5 1 c o m 3 / f p 2 7 8 p 1 . 5 / f p 2 2 9 p 1 . 6 / f p 2 1 1 0 p 1 . 7 / f p 2 0 1 2 p 2 . 0 / f p 1 8 1 3 p 2 . 1 / f p 1 7 1 4 p 2 . 2 / f p 1 6 1 5 l c d v c 1 6 l c d v p 2 1 1 p 0 . 1 / f p 1 9 1 7 l c d v b 1 8 l c d v a 1 9 l c d v p 1 2 0 f p 1 5 2 1 f p 1 4 2 2 f p 1 3 2 3 f p 1 2 2 4 f p 1 1 2 5 f p 1 0 2 6 f p 9 2 7 f p 8 2 8 f p 7 2 9 f p 6 3 0 f p 5 3 1 f p 4 3 2 f p 3 p i n 1 a d e 7 5 1 8 t o p v i e w ( n o t t o s c a l e ) 0 7 3 2 7 - 0 0 8 f i g u r e 8 . p i n c o n f i g u r a t i o n t a b l e 1 2 . p i n f u n c t i o n d e s c r i p t i o n s p i n n o . m n e m o n i c d e s c r i p t i o n 1 c o m 3 / f p 2 7 c o m m o n o u t p u t 3 o r l c d s e g m e n t o u t p u t 2 7 . c o m 3 i s u s e d f o r l c d b a c k p l a n e . 2 c o m 2 / f p 2 8 c o m m o n o u t p u t 2 o r l c d s e g m e n t o u t p u t 2 8 . c o m 2 i s u s e d f o r l c d b a c k p l a n e . 3 c o m 1 c o m m o n o u t p u t 1 . c o m 1 i s u s e d f o r l c d b a c k p l a n e . 4 c o m 0 c o m m o n o u t p u t 0 . c o m 0 i s u s e d f o r l c d b a c k p l a n e . 5 p 1 . 2 / f p 2 5 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 2 o r l c d s e g m e n t o u t p u t 2 5 . 6 p 1 . 3 / t 2 e x / f p 2 4 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 3 , t i m e r 2 c o n t r o l i n p u t , o r l c d s e g m e n t o u t p u t 2 4 . 7 p 1 . 4 / t 2 / f p 2 3 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 4 , t i m e r 2 i n p u t , o r l c d s e g m e n t o u t p u t 2 3 . 8 p 1 . 5 / f p 2 2 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 5 o r l c d s e g m e n t o u t p u t 2 2 . 9 p 1 . 6 / f p 2 1 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 6 o r l c d s e g m e n t o u t p u t 2 1 . 1 0 p 1 . 7 / f p 2 0 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 7 o r l c d s e g m e n t o u t p u t 2 0 . 1 1 p 0 . 1 / f p 1 9 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 1 o r l c d s e g m e n t o u t p u t 1 9 . 1 2 p 2 . 0 / f p 1 8 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 2 . 0 o r l c d s e g m e n t o u t p u t 1 8 . 1 3 p 2 . 1 / f p 1 7 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 2 . 1 o r l c d s e g m e n t o u t p u t 1 7 . 1 4 p 2 . 2 / f p 1 6 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 2 . 2 o r l c d s e g m e n t o u t p u t 1 6 . 1 5 l c d v c t h i s p i n i s i n t e r n a l l y c o n n e c t e d t o v d d . a r e s i s t o r s h o u l d b e c o n n e c t e d b e t w e e n l c d v c a n d l c d v b t o g e n e r a t e t h e t o p t w o v o l t a g e s f o r t h e l c d w a v e f o r m s ( s e e t h e l c d d r i v e r s e c t i o n ) . 1 6 l c d v p 2 t h i s p i n i s i n t e r n a l l y c o n n e c t e d t o l c d v p 1 ( s e e t h e l c d d r i v e r s e c t i o n ) . 1 7 l c d v b t h i s p i n i s a n i n p u t v o l t a g e f o r t h e l c d d r i v e r . a r e s i s t o r s h o u l d b e c o n n e c t e d b e t w e e n l c d v b a n d l c d v c t o g e n e r a t e a n i n t e r m e d i a t e v o l t a g e f o r t h e l c d d r i v e r . i n 1 / 3 b i a s l c d m o d e , a n o t h e r r e s i s t o r m u s t b e c o n n e c t e d b e t w e e n l c d v b a n d l c d v a t o g e n e r a t e a n o t h e r i n t e r m e d i a t e v o l t a g e . i n 1 / 2 b i a s l c d m o d e , l c d v b a n d l c d v a a r e i n t e r n a l l y c o n n e c t e d ( s e e t h e l c d d r i v e r s e c t i o n ) . 1 8 l c d v a t h i s p i n i s a n i n p u t v o l t a g e f o r t h e l c d d r i v e r . a r e s i s t o r s h o u l d b e c o n n e c t e d b e t w e e n l c d v a a n d l c d v p 1 t o g e n e r a t e a n i n t e r m e d i a t e v o l t a g e f o r t h e l c d d r i v e r . i n 1 / 3 b i a s l c d m o d e , a n o t h e r r e s i s t o r m u s t b e c o n n e c t e d b e t w e e n l c d v b a n d l c d v a t o g e n e r a t e a n o t h e r i n t e r m e d i a t e v o l t a g e . i n 1 / 2 b i a s l c d m o d e , l c d v b a n d l c d v a a r e i n t e r n a l l y c o n n e c t e d ( s e e t h e l c d d r i v e r s e c t i o n ) . 1 9 l c d v p 1 t h i s p i n i s a n i n p u t v o l t a g e f o r t h e l c d d r i v e r . a r e s i s t o r s h o u l d b e c o n n e c t e d b e t w e e n l c d v a a n d l c d v p 1 t o g e n e r a t e a n i n t e r m e d i a t e v o l t a g e f o r t h e l c d d r i v e r . a n o t h e r r e s i s t o r m u s t b e c o n n e c t e d b e t w e e n l c d v p 1 a n d d g n d t o g e n e r a t e a n o t h e r i n t e r m e d i a t e v o l t a g e ( s e e t h e l c d d r i v e r s e c t i o n ) . 3 5 t o 2 0 f p 0 t o f 1 5 l c d s e g m e n t o u t p u t 0 t o l c d s e g m e n t o u t p u t 1 5 . 3 6 p 1 . 1 / t x d g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 1 o r t r a n s m i t t e r d a t a o u t p u t ( a s y n c h r o n o u s ) .
a d e 7 5 1 8 r e v . 0 | p a g e 1 6 o f 1 2 8 p i n n o . m n e m o n i c d e s c r i p t i o n 3 7 p 1 . 0 / r x d g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 1 . 0 o r r e c e i v e r d a t a i n p u t ( a s y n c h r o n o u s ) . 3 8 p 0 . 7 / s s / t 1 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 7 , s l a v e s e l e c t w h e n s p i i s i n s l a v e m o d e , o r t i m e r 1 i n p u t . 3 9 p 0 . 6 / s c l k / t 0 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 6 , c l o c k o u t p u t f o r i 2 c o r s p i p o r t , o r t i m e r 0 i n p u t . 4 0 p 0 . 5 / m i s o g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 5 o r d a t a i n p u t f o r s p i p o r t . 4 1 p 0 . 4 / m o s i / s d a t a g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 4 , d a t a o u t p u t f o r s p i p o r t , o r i 2 c - c o m p a t i b l e d a t a l i n e . 4 2 p 0 . 3 / c f 2 g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 3 o r c a l i b r a t i o n f r e q u e n c y l o g i c o u t p u t 2 . t h e c f 2 l o g i c o u t p u t g i v e s i n s t a n t a n e o u s a c t i v e , r e a c t i v e , i r m s , o r a p p a r e n t p o w e r i n f o r m a t i o n . 4 3 p 0 . 2 / c f 1 / r t c c a l g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 2 , c a l i b r a t i o n f r e q u e n c y l o g i c o u t p u t 1 , o r r t c c a l i b r a t i o n f r e q u e n c y l o g i c o u t p u t . t h e c f 1 l o g i c o u t p u t g i v e s i n s t a n t a n e o u s a c t i v e , r e a c t i v e , i r m s , o r a p p a r e n t p o w e r i n f o r m a t i o n . t h e r t c c a l l o g i c o u t p u t g i v e s a c c e s s t o t h e c a l i b r a t e d r t c o u t p u t . 4 4 s d e n / p 2 . 3 s e r i a l d o w n l o a d m o d e e n a b l e o r d i g i t a l o u t p u t p o r t p 2 . 3 . t h i s p i n i s u s e d t o e n a b l e s e r i a l d o w n l o a d m o d e t h r o u g h a r e s i s t o r w h e n p u l l e d l o w o n p o w e r - u p o r r e s e t . o n r e s e t , t h i s p i n m o m e n t a r i l y b e c o m e s a n i n p u t a n d t h e s t a t u s o f t h e p i n i s s a m p l e d . i f t h e r e i s n o p u l l - d o w n r e s i s t o r i n p l a c e , t h e p i n m o m e n t a r i l y g o e s h i g h a n d t h e n u s e r c o d e i s e x e c u t e d . i f t h e p i n i s p u l l e d d o w n o n r e s e t , t h e e m b e d d e d s e r i a l d o w n l o a d / d e b u g k e r n e l e x e c u t e s , a n d t h i s p i n r e m a i n s l o w d u r i n g t h e i n t e r n a l p r o g r a m e x e c u t i o n . a f t e r r e s e t , t h i s p i n c a n b e u s e d a s a d i g i t a l o u t p u t p o r t p i n ( p 2 . 3 ) . 4 5 b c t r l / i n t 1 / p 0 . 0 d i g i t a l i n p u t f o r b a t t e r y c o n t r o l , e x t e r n a l i n t e r r u p t i n p u t 1 , o r g e n e r a l - p u r p o s e d i g i t a l i / o p o r t 0 . 0 . t h i s l o g i c i n p u t c o n n e c t s v d d o r v b a t t o v s w o u t i n t e r n a l l y w h e n s e t t o l o g i c h i g h o r l o g i c l o w , r e s p e c t i v e l y . w h e n l e f t o p e n , t h e c o n n e c t i o n b e t w e e n v d d a n d v s w o u t o r b e t w e e n v b a t a n d v s w o u t i s s e l e c t e d i n t e r n a l l y . 4 6 x t a l 2 a c r y s t a l c a n b e c o n n e c t e d a c r o s s t h i s p i n a n d x t a l 1 ( s e e t h e x t a l 1 p i n d e s c r i p t i o n ) t o p r o v i d e a c l o c k s o u r c e f o r t h e a d e 7 5 1 8 . t h e x t a l 2 p i n c a n d r i v e o n e c m o s l o a d w h e n a n e x t e r n a l c l o c k i s s u p p l i e d a t x t a l 1 o r b y t h e g a t e o s c i l l a t o r c i r c u i t . a n i n t e r n a l 6 p f c a p a c i t o r i s c o n n e c t e d t o t h i s p i n . 4 7 x t a l 1 a n e x t e r n a l c l o c k c a n b e p r o v i d e d a t t h i s l o g i c i n p u t . a l t e r n a t i v e l y , a p a r a l l e l r e s o n a n t a t c r y s t a l c a n b e c o n n e c t e d a c r o s s x t a l 1 a n d x t a l 2 t o p r o v i d e a c l o c k s o u r c e f o r t h e a d e 7 5 1 8 . t h e c l o c k f r e q u e n c y f o r s p e c i f i e d o p e r a t i o n i s 3 2 . 7 6 8 k h z . a n i n t e r n a l 6 p f c a p a c i t o r i s c o n n e c t e d t o t h i s p i n . 4 8 i n t 0 e x t e r n a l i n t e r r u p t i n p u t 0 . 4 9 , 5 0 v p , v n a n a l o g i n p u t s f o r v o l t a g e c h a n n e l . t h e s e i n p u t s a r e f u l l y d i f f e r e n t i a l v o l t a g e i n p u t s w i t h a m a x i m u m d i f f e r e n t i a l l e v e l o f 4 0 0 m v f o r s p e c i f i e d o p e r a t i o n . t h i s c h a n n e l a l s o h a s a n i n t e r n a l p g a . 5 1 e a t h i s p i n i s u s e d a s a n i n p u t f o r e m u l a t i o n . w h e n h e l d h i g h , t h i s i n p u t e n a b l e s t h e d e v i c e t o f e t c h c o d e f r o m i n t e r n a l p r o g r a m m e m o r y l o c a t i o n s . t h e a d e 7 5 1 8 d o e s n o t s u p p o r t e x t e r n a l c o d e m e m o r y . t h i s p i n s h o u l d n o t b e l e f t f l o a t i n g . 5 2 , 5 3 i p , i n a n a l o g i n p u t s f o r c u r r e n t c h a n n e l . t h e s e i n p u t s a r e f u l l y d i f f e r e n t i a l v o l t a g e i n p u t s w i t h a m a x i m u m d i f f e r e n t i a l l e v e l o f 4 0 0 m v f o r s p e c i f i e d o p e r a t i o n . t h i s c h a n n e l a l s o h a s a n i n t e r n a l p g a . 5 4 a g n d t h i s p i n p r o v i d e s t h e g r o u n d r e f e r e n c e f o r t h e a n a l o g c i r c u i t r y . 5 5 f p 2 6 l c d s e g m e n t o u t p u t 2 6 . 5 6 r e s e t r e s e t i n p u t , a c t i v e l o w . 5 7 r e f i n / o u t t h i s p i n p r o v i d e s a c c e s s t o t h e o n - c h i p v o l t a g e r e f e r e n c e . t h e o n - c h i p r e f e r e n c e h a s a n o m i n a l v a l u e o f 1 . 2 v 0 . 1 % a n d a t y p i c a l t e m p e r a t u r e c o e f f i c i e n t o f 5 0 p p m / c m a x i m u m . t h i s p i n s h o u l d b e d e c o u p l e d w i t h a 1 f c a p a c i t o r i n p a r a l l e l w i t h a c e r a m i c 1 0 0 n f c a p a c i t o r . 5 8 v b a t p o w e r s u p p l y i n p u t f r o m t h e b a t t e r y w i t h a 2 . 4 v t o 2 . 7 v r a n g e . t h i s p i n i s c o n n e c t e d i n t e r n a l l y t o v d d w h e n t h e b a t t e r y i s s e l e c t e d a s t h e p o w e r s u p p l y f o r t h e a d e 7 5 1 8 . 5 9 v i n t a t h i s p i n p r o v i d e s a c c e s s t o t h e o n - c h i p 2 . 5 v a n a l o g l d o . n o e x t e r n a l a c t i v e c i r c u i t r y s h o u l d b e c o n n e c t e d t o t h i s p i n . t h i s p i n s h o u l d b e d e c o u p l e d w i t h a 1 0 f c a p a c i t o r i n p a r a l l e l w i t h a c e r a m i c 1 0 0 n f c a p a c i t o r . 6 0 v d d 3 . 3 v p o w e r s u p p l y i n p u t f r o m t h e r e g u l a t o r . t h i s p i n i s c o n n e c t e d i n t e r n a l l y t o v d d w h e n t h e r e g u l a t o r i s s e l e c t e d a s t h e p o w e r s u p p l y f o r t h e a d e 7 5 1 8 . t h i s p i n s h o u l d b e d e c o u p l e d w i t h a 1 0 f c a p a c i t o r i n p a r a l l e l w i t h a c e r a m i c 1 0 0 n f c a p a c i t o r . 6 1 v s w o u t 3 . 3 v p o w e r s u p p l y o u t p u t . t h i s p i n p r o v i d e s t h e s u p p l y v o l t a g e f o r t h e l d o s a n d i n t e r n a l c i r c u i t r y o f t h e a d e 7 5 1 8 . t h i s p i n s h o u l d b e d e c o u p l e d w i t h a 1 0 f c a p a c i t o r i n p a r a l l e l w i t h a c e r a m i c 1 0 0 n f c a p a c i t o r . 6 2 v i n t d t h i s p i n p r o v i d e s a c c e s s t o t h e o n - c h i p 2 . 5 v d i g i t a l l d o . n o e x t e r n a l a c t i v e c i r c u i t r y s h o u l d b e c o n n e c t e d t o t h i s p i n . t h i s p i n s h o u l d b e d e c o u p l e d w i t h a 1 0 f c a p a c i t o r i n p a r a l l e l w i t h a c e r a m i c 1 0 0 n f c a p a c i t o r . 6 3 d g n d t h i s p i n p r o v i d e s t h e g r o u n d r e f e r e n c e f o r t h e d i g i t a l c i r c u i t r y . 6 4 v d c i n a n a l o g i n p u t f o r d c v o l t a g e m o n i t o r i n g . t h e m a x i m u m i n p u t v o l t a g e o n t h i s p i n i s v s w o u t w i t h r e s p e c t t o a g n d . t h i s p i n i s u s e d t o m o n i t o r t h e p r e r e g u l a t e d d c v o l t a g e .
a d e 7 5 1 8 r e v . 0 | p a g e 1 7 o f 1 2 8 t y p i c a l p e r f o r m a n c e c h a r a c t e r i s t i c s ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 ? 4 0 c ; p f = 1 + 2 5 c ; p f = 1 + 8 5 c ; p f = 1 m i d c l a s s c m i d c l a s s c 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 0 9 f i g u r e 9 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e g a i n = 1 i n t e r n a l r e f e r e n c e ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) m i d c l a s s c m i d c l a s s c + 2 5 c ; p f = 1 + 8 5 c ; p f = 1 ? 4 0 c ; p f = 1 + 2 5 c ; p f = 0 . 5 + 8 5 c ; p f = 0 . 5 ? 4 0 c ; p f = 0 . 5 0 7 3 2 7 - 0 1 0 f i g u r e 1 0 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e + 8 5 c ; p f = 0 + 2 5 c ; p f = 0 ? 4 0 c ; p f = 0 0 7 3 2 7 - 0 1 1 f i g u r e 1 1 . r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e + 8 5 c ; p f = 0 . 8 6 6 + 2 5 c ; p f = 0 . 8 6 6 ? 4 0 c ; p f = 0 . 8 6 6 + 8 5 c ; p f = 0 + 2 5 c ; p f = 0 ? 4 0 c ; p f = 0 0 7 3 2 7 - 0 1 2 f i g u r e 1 2 . r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 ? 4 0 c ; p f = 1 + 2 5 c ; p f = 1 + 8 5 c ; p f = 1 m i d c l a s s c m i d c l a s s c 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 1 3 f i g u r e 1 3 . c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 ? 4 0 c ; p f = 1 ? 4 0 c ; p f = 0 . 5 + 2 5 c ; p f = 1 + 2 5 c ; p f = 0 . 5 + 8 5 c ; p f = 0 . 5 + 8 5 c ; p f = 1 m i d c l a s s c m i d c l a s s c 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 1 4 f i g u r e 1 4 . c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e
a d e 7 5 1 8 r e v . 0 | p a g e 1 8 o f 1 2 8 ? 0 . 5 ? 0 . 4 ? 0 . 3 ? 0 . 2 ? 0 . 1 0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e v r m s ; 3 . 3 v i r m s ; 3 . 1 3 v i r m s ; 3 . 3 v i r m s ; 3 . 4 3 v v r m s ; 3 . 1 3 v v r m s ; 3 . 4 3 v 0 7 3 2 7 - 0 1 5 f i g u r e 1 5 . v o l t a g e a n d c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r p o w e r s u p p l y w i t h i n t e r n a l r e f e r e n c e ? 1 . 0 ? 0 . 8 ? 0 . 6 ? 0 . 4 ? 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 . 0 4 0 4 5 5 0 5 5 6 0 6 5 7 0 p f = 1 p f = 0 . 5 m i d c l a s s b m i d c l a s s b g a i n = 1 i n t e r n a l r e f e r e n c e l i n e f r e q u e n c y ( h z ) e r r o r ( % o f r e a d i n g ) 0 7 3 2 7 - 0 1 6 f i g u r e 1 6 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r f r e q u e n c y w i t h i n t e r n a l r e f e r e n c e ? 0 . 5 ? 0 . 4 ? 0 . 3 ? 0 . 2 ? 0 . 1 0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 i n t e r n a l r e f e r e n c e v a r ; 3 . 3 v w a t t ; 3 . 4 3 v w a t t ; 3 . 1 3 v w a t t ; 3 . 3 v v a r ; 3 . 4 3 v v a r ; 3 . 1 3 v 0 7 3 2 7 - 0 1 7 f i g u r e 1 7 . a c t i v e a n d r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 ) o v e r p o w e r s u p p l y w i t h i n t e r n a l r e f e r e n c e ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 0 . 1 1 1 0 1 0 0 p f = + 0 . 5 p f = 1 p f = ? 0 . 5 m i d c l a s s c m i d c l a s s c c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 8 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 1 8 f i g u r e 1 8 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 8 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 0 . 8 ? 0 . 6 ? 0 . 4 ? 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 p f = + 0 . 5 p f = ? 0 . 5 ? 1 . 0 1 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 8 i n t e r n a l r e f e r e n c e p f = 1 0 7 3 2 7 - 0 1 9 f i g u r e 1 9 . r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 8 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 0 . 1 1 1 0 1 0 0 p f = + 0 . 5 p f = 1 p f = ? 0 . 5 m i d c l a s s c m i d c l a s s c c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 8 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 2 0 f i g u r e 2 0 . c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 8 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e
a d e 7 5 1 8 r e v . 0 | p a g e 1 9 o f 1 2 8 ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 ? 4 0 c ; p f = 1 + 2 5 c ; p f = 1 + 8 5 c ; p f = 1 m i d c l a s s c m i d c l a s s c 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e 0 7 3 2 7 - 0 2 1 f i g u r e 2 1 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e m i d c l a s s c m i d c l a s s c ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e + 8 5 c ; p f = 1 ? 4 0 c ; p f = 1 ? 4 0 c ; p f = 0 . 5 + 8 5 c ; p f = 0 . 5 + 2 5 c ; p f = 1 + 2 5 c ; p f = 0 . 5 0 7 3 2 7 - 0 2 2 f i g u r e 2 2 . a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 0 . 8 ? 0 . 6 ? 0 . 4 ? 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 ? 1 . 0 1 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e + 8 5 c ; p f = 0 ? 4 0 c ; p f = 0 + 2 5 c ; p f = 0 0 7 3 2 7 - 0 2 3 f i g u r e 2 3 . r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e ? 0 . 8 ? 1 . 0 ? 0 . 6 ? 0 . 4 ? 0 . 2 0 0 . 2 0 . 4 0 . 6 0 . 8 1 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e ? 4 0 c ; p f = 0 + 8 5 c ; p f = 0 + 8 5 c ; p f = 0 . 8 6 6 ? 4 0 c ; p f = 0 . 8 6 6 + 2 5 c ; p f = 0 . 8 6 6 + 2 5 c ; p f = 0 0 7 3 2 7 - 0 2 4 f i g u r e 2 4 . r e a c t i v e e n e r g y e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e ? 4 0 c ; p f = 1 + 8 5 c ; p f = 1 m i d c l a s s c m i d c l a s s c ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e + 2 5 c ; p f = 1 0 7 3 2 7 - 0 2 5 f i g u r e 2 5 . c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r t e m p e r a t u r e w i t h i n t e r n a l r e f e r e n c e m i d c l a s s c m i d c l a s s c ? 2 . 0 ? 1 . 5 ? 1 . 0 ? 0 . 5 0 0 . 5 1 . 0 1 . 5 2 . 0 0 . 1 1 1 0 1 0 0 c u r r e n t c h a n n e l ( % o f f u l l s c a l e ) e r r o r ( % o f r e a d i n g ) g a i n = 1 6 i n t e r n a l r e f e r e n c e ? 4 0 c ; p f = 1 + 2 5 c ; p f = 1 ? 4 0 c ; p f = 0 . 5 + 8 5 c ; p f = 0 . 5 + 2 5 c ; p f = 0 . 5 + 8 5 c ; p f = 1 0 7 3 2 7 - 0 2 6 f i g u r e 2 6 . c u r r e n t r m s e r r o r a s a p e r c e n t a g e o f r e a d i n g ( g a i n = 1 6 ) o v e r p o w e r f a c t o r w i t h i n t e r n a l r e f e r e n c e
a d e 7 5 1 8 r e v . 0 | p a g e 2 0 o f 1 2 8 t e r m i n o l o g y m e a s u r e m e n t e r r o r t h e e r r o r a s s o c i a t e d w i t h t h e e n e r g y m e a s u r e m e n t m a d e b y t h e a d e 7 5 1 8 i s d e f i n e d b y t h e f o l l o w i n g f o r m u l a : p e r c e n t a g e e r r o r = % 1 0 0 u ? ?1 ?  e n e r g y t r u e e n e r g y t r u e r e g i s t e r e n e r g y p h a s e e r r o r b e t w e e n c h a n n e l s t h e d i g i t a l i n t e g r a t o r a n d t h e h i g h - p a s s f i l t e r ( h p f ) i n t h e c u r r e n t c h a n n e l h a v e a n o n i d e a l p h a s e r e s p o n s e . t o o f f s e t t h i s p h a s e r e s p o n s e a n d e q u a l i z e t h e p h a s e r e s p o n s e b e t w e e n c h a n n e l s , t w o p h a s e c o r r e c t i o n n e t w o r k s a r e p l a c e d i n t h e c u r r e n t c h a n n e l : o n e f o r t h e d i g i t a l i n t e g r a t o r a n d t h e o t h e r f o r t h e h p f . t h e p h a s e c o r r e c t i o n n e t w o r k s c o r r e c t t h e p h a s e r e s p o n s e o f t h e c o r r e s p o n d i n g c o m p o n e n t a n d e n s u r e a p h a s e m a t c h b e t w e e n c u r r e n t c h a n n e l a n d v o l t a g e c h a n n e l t o w i t h i n 0 . 1 o v e r a r a n g e o f 4 5 h z t o 6 5 h z w i t h t h e d i g i t a l i n t e g r a t o r o f f . w i t h t h e d i g i t a l i n t e g r a t o r o n , t h e p h a s e i s c o r r e c t e d t o w i t h i n 0 . 4 o v e r a r a n g e o f 4 5 h z t o 6 5 h z . p o w e r s u p p l y r e j e c t i o n ( p s r ) p s r q u a n t i f i e s t h e a d e 7 5 1 8 m e a s u r e m e n t e r r o r a s a p e r c e n t a g e o f r e a d i n g w h e n t h e p o w e r s u p p l i e s a r e v a r i e d . f o r t h e a c p s r m e a s u r e m e n t , a r e a d i n g a t n o m i n a l s u p p l i e s ( 3 . 3 v ) i s t a k e n . a s e c o n d r e a d i n g i s o b t a i n e d w i t h t h e s a m e i n p u t s i g n a l l e v e l s w h e n a n a c ( 1 0 0 m v r m s / 1 2 0 h z ) s i g n a l i s i n t r o d u c e d o n t o t h e s u p p l i e s . a n y e r r o r i n t r o d u c e d b y t h i s a c s i g n a l i s e x p r e s s e d a s a p e r c e n t a g e o f r e a d i n g ( s e e t h e m e a s u r e m e n t e r r o r d e f i n i t i o n ) . f o r t h e d c p s r m e a s u r e m e n t , a r e a d i n g a t n o m i n a l s u p p l i e s ( 3 . 3 v ) i s t a k e n . a s e c o n d r e a d i n g i s o b t a i n e d w i t h t h e s a m e i n p u t s i g n a l l e v e l s w h e n t h e s u p p l i e s a r e v a r i e d 5 % . a n y e r r o r i n t r o d u c e d i s a g a i n e x p r e s s e d a s a p e r c e n t a g e o f t h e r e a d i n g . a d c o f f s e t e r r o r a d c o f f s e t e r r o r i s t h e d c o f f s e t a s s o c i a t e d w i t h t h e a n a l o g i n p u t s t o t h e a d c s . i t m e a n s t h a t , w i t h t h e a n a l o g i n p u t s c o n n e c t e d t o a g n d , t h e a d c s s t i l l s e e a d c a n a l o g i n p u t s i g n a l . t h e m a g n i t u d e o f t h e o f f s e t d e p e n d s o n t h e g a i n a n d i n p u t r a n g e s e l e c t i o n ( s e e t h e t y p i c a l p e r f o r m a n c e c h a r a c t e r i s t i c s s e c t i o n ) . h o w e v e r , w h e n h p f 1 i s s w i t c h e d o n , t h e o f f s e t i s r e m o v e d f r o m t h e c u r r e n t c h a n n e l , a n d t h e p o w e r c a l c u l a t i o n i s n o t a f f e c t e d b y t h i s o f f s e t . t h e o f f s e t s c a n b e r e m o v e d b y p e r f o r m i n g a n o f f s e t c a l i b r a t i o n ( s e e t h e a n a l o g i n p u t s s e c t i o n ) . g a i n e r r o r g a i n e r r o r i s t h e d i f f e r e n c e b e t w e e n t h e m e a s u r e d a d c o u t p u t c o d e ( m i n u s t h e o f f s e t ) a n d t h e i d e a l o u t p u t c o d e ( s e e t h e c u r r e n t c h a n n e l a d c s e c t i o n a n d t h e v o l t a g e c h a n n e l a d c s e c t i o n ) . i t i s m e a s u r e d f o r e a c h o f t h e g a i n s e t t i n g s o n t h e c u r r e n t c h a n n e l ( 1 , 2 , 4 , 8 , a n d 1 6 ) . t h e d i f f e r e n c e i s e x p r e s s e d a s a p e r c e n t a g e o f t h e i d e a l c o d e .
a d e 7 5 1 8 r e v . 0 | p a g e 2 1 o f 1 2 8 s f r m a p p i n g t a b l e 1 3 . m n e m o n i c a d d r e s s d e t a i l s i n t p r 0 x f f t a b l e 1 5 s c r a t c h 4 0 x f e t a b l e 2 3 s c r a t c h 3 0 x f d t a b l e 2 2 s c r a t c h 2 0 x f c t a b l e 2 1 s c r a t c h 1 0 x f b t a b l e 2 0 i p s m f 0 x f 8 t a b l e 1 6 t e m p c a l 0 x f 7 t a b l e 1 1 6 r t c c o m p 0 x f 6 t a b l e 1 1 5 b a t p r 0 x f 5 t a b l e 1 7 p e r i p h 0 x f 4 t a b l e 1 8 b 0 x f 0 t a b l e 4 5 l c d s e g e 2 0 x e d t a b l e 7 7 i p s m e 0 x e c t a b l e 1 9 s p i s t a t 0 x e a t a b l e 1 3 1 s p i 2 c s t a t 0 x e a t a b l e 1 3 5 s p i m o d 2 0 x e 9 t a b l e 1 3 0 i 2 c a d r 0 x e 9 t a b l e 1 3 4 s p i m o d 1 0 x e 8 t a b l e 1 2 9 i 2 c m o d 0 x e 8 t a b l e 1 3 3 w a v 2 h 0 x e 7 t a b l e 2 9 w a v 2 m 0 x e 6 t a b l e 2 9 w a v 2 l 0 x e 5 t a b l e 2 9 w a v 1 h 0 x e 4 t a b l e 2 9 w a v 1 m 0 x e 3 t a b l e 2 9 w a v 1 l 0 x e 2 t a b l e 2 9 a c c 0 x e 0 t a b l e 4 5 m i r q s t h 0 x d e t a b l e 3 9 m i r q s t m 0 x d d t a b l e 3 8 m i r q s t l 0 x d c t a b l e 3 7 m i r q e n h 0 x d b t a b l e 4 2 m i r q e n m 0 x d a t a b l e 4 1 m i r q e n l 0 x d 9 t a b l e 4 0 i r m s h 0 x d 6 t a b l e 2 9 i r m s m 0 x d 5 t a b l e 2 9 i r m s l 0 x d 4 t a b l e 2 9 v r m s h 0 x d 3 t a b l e 2 9 v r m s m 0 x d 2 t a b l e 2 9 v r m s l 0 x d 1 t a b l e 2 9 p s w 0 x d 0 t a b l e 4 6 t h 2 0 x c d t a b l e 9 9 t l 2 0 x c c t a b l e 1 0 0 r c a p 2 h 0 x c b t a b l e 1 0 1 r c a p 2 l 0 x c a t a b l e 1 0 2 t 2 c o n 0 x c 8 t a b l e 9 4 e a d r h 0 x c 7 t a b l e 8 9 e a d r l 0 x c 6 t a b l e 8 8 p o w c o n 0 x c 5 t a b l e 2 4 k y r e g 0 x c 1 t a b l e 1 0 5 w d c o n 0 x c 0 t a b l e 6 5 p r o t r 0 x b f t a b l e 8 7 m n e m o n i c a d d r e s s d e t a i l s p r o t b 1 0 x b e t a b l e 8 6 p r o t b 0 0 x b d t a b l e 8 5 e d a t a 0 x b c t a b l e 8 4 p r o t k y 0 x b b t a b l e 8 3 f l s h k y 0 x b a t a b l e 8 2 e c o n 0 x b 9 t a b l e 8 1 i p 0 x b 8 t a b l e 5 9 p i n m a p 2 0 x b 4 t a b l e 1 4 0 p i n m a p 1 0 x b 3 t a b l e 1 3 9 p i n m a p 0 0 x b 2 t a b l e 1 3 8 l c d c o n y 0 x b 1 t a b l e 7 0 c f g 0 x a f t a b l e 5 2 l c d d a t 0 x a e t a b l e 7 6 l c d p t r 0 x a c t a b l e 7 5 i e i p 2 0 x a 9 t a b l e 6 0 i e 0 x a 8 t a b l e 5 8 d p c o n 0 x a 7 t a b l e 5 6 i n t v a l 0 x a 6 t a b l e 1 1 4 h o u r 0 x a 5 t a b l e 1 1 3 m i n 0 x a 4 t a b l e 1 1 2 s e c 0 x a 3 t a b l e 1 1 1 h t h s e c 0 x a 2 t a b l e 1 1 0 t i m e c o n 0 x a 1 t a b l e 1 0 9 p 2 0 x a 0 t a b l e 1 4 3 e p c f g 0 x 9 f t a b l e 1 3 7 s b a u d t 0 x 9 e t a b l e 1 2 3 s b a u d f 0 x 9 d t a b l e 1 2 4 l c d c o n x 0 x 9 c t a b l e 6 9 s p i 2 c r x 0 x 9 b t a b l e 1 2 8 s p i 2 c t x 0 x 9 a t a b l e 1 2 7 s b u f 0 x 9 9 t a b l e 1 2 2 s c o n 0 x 9 8 t a b l e 1 2 1 l c d s e g e 0 x 9 7 t a b l e 7 4 l c d c l k 0 x 9 6 t a b l e 7 1 l c d c o n 0 x 9 5 t a b l e 6 8 m d a t h 0 x 9 4 t a b l e 2 9 m d a t m 0 x 9 3 t a b l e 2 9 m d a t l 0 x 9 2 t a b l e 2 9 m a d d p t 0 x 9 1 t a b l e 2 9 p 1 0 x 9 0 t a b l e 1 4 2 t h 1 0 x 8 d t a b l e 9 7 t h 0 0 x 8 c t a b l e 9 5 t l 1 0 x 8 b t a b l e 9 8 t l 0 0 x 8 a t a b l e 9 6 t m o d 0 x 8 9 t a b l e 9 2 t c o n 0 x 8 8 t a b l e 9 3 p c o n 0 x 8 7 t a b l e 4 7 d p h 0 x 8 3 t a b l e 4 9 d p l 0 x 8 2 t a b l e 4 8 s p 0 x 8 1 t a b l e 5 1 p 0 0 x 8 0 t a b l e 1 4 1
a d e 7 5 1 8 r e v . 0 | p a g e 2 2 o f 1 2 8 p o w e r m a n a g e m e n t t h e a d e 7 5 1 8 h a s e l a b o r a t e p o w e r m a n a g e m e n t c i r c u i t r y t h a t m a n a g e s t h e r e g u l a r p o w e r s u p p l y t o b a t t e r y s w i t c h o v e r a n d p o w e r s u p p l y f a i l u r e s . t h e p o w e r m a n a g e m e n t f u n c t i o n a l i t i e s c a n b e a c c e s s e d d i r e c t l y t h r o u g h t h e 8 0 5 2 s f r s ( s e e t a b l e 1 4 ) . t a b l e 1 4 . p o w e r m a n a g e m e n t s f r s s f r a d d r e s s r / w m n e m o n i c d e s c r i p t i o n 0 x e c r / w i p s m e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e . s e e t a b l e 1 9 . 0 x f 5 r / w b a t p r b a t t e r y s w i t c h o v e r c o n f i g u r a t i o n . s e e t a b l e 1 7 . 0 x f 8 r / w i p s m f p o w e r m a n a g e m e n t i n t e r r u p t f l a g . s e e t a b l e 1 6 . 0 x f f r / w i n t p r i n t e r r u p t p i n s c o n f i g u r a t i o n . s e e t a b l e 1 5 . 0 x f 4 r / w p e r i p h p e r i p h e r a l c o n f i g u r a t i o n s f r . s e e t a b l e 1 8 . 0 x c 5 r / w p o w c o n p o w e r c o n t r o l . s e e t a b l e 2 4 . 0 x f b r / w s c r a t c h 1 s c r a t c h p a d 1 . s e e t a b l e 2 0 . 0 x f c r / w s c r a t c h 2 s c r a t c h p a d 2 . s e e t a b l e 2 1 . 0 x f d r / w s c r a t c h 3 s c r a t c h p a d 3 . s e e t a b l e 2 2 . 0 x f e r / w s c r a t c h 4 s c r a t c h p a d 4 . s e e t a b l e 2 3 . p o w e r m a n a g e m e n t r e g i s t e r d e t a i l s t a b l e 1 5 . i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r t c c a l 0 c o n t r o l s t h e r t c c a l i b r a t i o n o u t p u t . w h e n t h i s b i t i s s e t , t h e r t c c a l i b r a t i o n f r e q u e n c y s e l e c t e d b y f s e l [ 1 : 0 ] i s o u t p u t o n t h e p 0 . 2 / c f 1 / r t c c a l p i n . 6 t o 5 f s e l [ 1 : 0 ] 0 0 s e t s t h e r t c c a l i b r a t i o n o u t p u t f r e q u e n c y a n d c a l i b r a t i o n w i n d o w . f s e l [ 1 : 0 ] r e s u l t ( c a l i b r a t i o n w i n d o w , f r e q u e n c y ) 0 0 3 0 . 5 s e c , 1 h z 0 1 3 0 . 5 s e c , 5 1 2 h z 1 0 0 . 2 4 4 s e c , 5 0 0 h z 1 1 0 . 2 4 4 s e c , 1 6 . 3 8 4 k h z 4 r e s e r v e d n / a 3 t o 1 i n t 1 p r g [ 2 : 0 ] 0 0 0 c o n t r o l s t h e f u n c t i o n o f i n t 1 . i n t 1 p r g [ 2 : 0 ] r e s u l t x 0 0 g p i o e n a b l e d x 0 1 b c t r l e n a b l e d 0 1 x i n t 1 i n p u t d i s a b l e d 1 1 x i n t 1 i n p u t e n a b l e d 0 i n t 0 p r g 0 c o n t r o l s t h e f u n c t i o n o f i n t 0 . i n t 0 p r g r e s u l t 0 i n t 0 i n p u t d i s a b l e d 1 i n t 0 i n p u t e n a b l e d w r i t i n g t o t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) t o p r o t e c t t h e r t c f r o m r u n a w a y c o d e , a k e y m u s t b e w r i t t e n t o t h e k e y s f r ( k y r e g , 0 x c 1 ) t o o b t a i n w r i t e a c c e s s t o i n t p r . k y r e g ( s e e t a b l e 1 0 5 ) s h o u l d b e s e t t o 0 x e a t o u n l o c k t h i s s f r a n d t h e n r e s e t t o z e r o a f t e r a t i m e k e e p i n g r e g i s t e r i s w r i t t e n t o . t h e r t c r e g i s t e r s c a n b e w r i t t e n u s i n g t h e f o l l o w i n g 8 0 5 2 a s s e m b l y c o d e : m o v k y r e g , # 0 e a h m o v i n t p r , # 0 8 0 h
a d e 7 5 1 8 r e v . 0 | p a g e 2 3 o f 1 2 8 t a b l e 1 6 . p o w e r m a n a g e m e n t i n t e r r u p t f l a g s f r ( i p s m f , 0 x f 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 x f f f p s r 0 p o w e r s u p p l y r e s t o r e d i n t e r r u p t f l a g . s e t w h e n t h e v d d p o w e r s u p p l y h a s b e e n r e s t o r e d . t h i s o c c u r s w h e n t h e s o u r c e o f v s w o u t c h a n g e s f r o m v b a t t o v d d . 6 0 x f e f p s m 0 p s m i n t e r r u p t f l a g . s e t w h e n a n e n a b l e d p s m i n t e r r u p t c o n d i t i o n o c c u r s . 5 0 x f d f s a g 0 v o l t a g e s a g i n t e r r u p t f l a g . s e t w h e n a n a d e e n e r g y m e a s u r e m e n t s a g c o n d i t i o n o c c u r s . 4 0 x f c r e s e r v e d 0 t h i s b i t m u s t b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 3 0 x f b r e s e r v e d 0 t h i s b i t m u s t b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 2 0 x f a r e s e r v e d 0 t h i s b i t m u s t b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 1 0 x f 9 f b s o 0 b a t t e r y s w i t c h o v e r i n t e r r u p t f l a g . s e t w h e n v s w o u t s w i t c h e s f r o m v d d t o v b a t . 0 0 x f 8 f v d c i n 0 v d c i n m o n i t o r i n t e r r u p t f l a g . s e t w h e n v d c i n f a l l s b e l o w 1 . 2 v . t a b l e 1 7 . b a t t e r y s w i t c h o v e r c o n f i g u r a t i o n s f r ( b a t p r , 0 x f 5 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 2 r e s e r v e d 0 t h e s e b i t s m u s t b e k e p t t o 0 f o r p r o p e r o p e r a t i o n . 1 t o 0 b a t p r g [ 1 : 0 ] 0 0 c o n t r o l b i t s f o r b a t t e r y s w i t c h o v e r . b a t p r g [ 1 : 0 ] r e s u l t 0 0 b a t t e r y s w i t c h o v e r e n a b l e d o n l o w v d d 0 1 b a t t e r y s w i t c h o v e r e n a b l e d o n l o w v d d a n d l o w v d c i n 1 x b a t t e r y s w i t c h o v e r d i s a b l e d t a b l e 1 8 . p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r x f l a g 0 i f s e t , i n d i c a t e s t h a t a n r x e d g e e v e n t t r i g g e r e d w a k e - u p f r o m p s m 2 . 6 v s w s o u r c e 1 i n d i c a t e s t h e p o w e r s u p p l y t h a t i s i n t e r n a l l y c o n n e c t e d t o v s w o u t ( 0 v s w o u t = v b a t , 1 v s w o u t = v d d ) . 5 v d d _ o k 1 i f s e t , i n d i c a t e s t h a t t h e v d d p o w e r s u p p l y i s r e a d y f o r o p e r a t i o n . 4 p l l _ f l t 0 i f s e t , i n d i c a t e s t h a t a p l l f a u l t o c c u r r e d w h e r e t h e p l l l o s t l o c k . s e t t h e p l l _ f t l _ a c k b i t ( s e e t a b l e 1 0 7 ) i n t h e s t a r t a d c m e a s u r e m e n t s f r ( a d c g o , 0 x d 8 ) t o a c k n o w l e d g e t h e f a u l t a n d c l e a r t h e p l l _ f l t b i t . 3 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t t o 0 . 2 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t t o 0 . 1 t o 0 r x p r o g [ 1 : 0 ] 0 0 c o n t r o l s t h e f u n c t i o n o f t h e p 1 . 0 / r x d p i n . r x p r o g [ 1 : 0 ] r e s u l t 0 0 g p i o 0 1 r x d w i t h w a k e - u p d i s a b l e d 1 1 r x d w i t h w a k e - u p e n a b l e d t a b l e 1 9 . p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 e p s r 0 e n a b l e s a p s m i n t e r r u p t w h e n t h e p o w e r s u p p l y r e s t o r e d f l a g ( f p s r ) i s s e t . 6 r e s e r v e d 0 r e s e r v e d . 5 e s a g 0 e n a b l e s a p s m i n t e r r u p t w h e n t h e v o l t a g e s a g f l a g ( f s a g ) i s s e t . 4 t o 2 r e s e r v e d 0 t h e s e b i t s m u s t b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 1 e b s o 0 e n a b l e s a p s m i n t e r r u p t w h e n t h e b a t t e r y s w i t c h o v e r f l a g ( f b s o ) i s s e t . 0 e v d c i n 0 e n a b l e s a p s m i n t e r r u p t w h e n t h e v d c i n m o n i t o r f l a g ( f v d c i n ) i s s e t . t a b l e 2 0 . s c r a t c h p a d 1 s f r ( s c r a t c h 1 , 0 x f b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s c r a t c h 1 0 v a l u e c a n b e w r i t t e n / r e a d i n t h i s r e g i s t e r . t h i s v a l u e i s m a i n t a i n e d i n a l l t h e p o w e r s a v i n g m o d e s .
a d e 7 5 1 8 r e v . 0 | p a g e 2 4 o f 1 2 8 t a b l e 2 1 . s c r a t c h p a d 2 s f r ( s c r a t c h 2 , 0 x f c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s c r a t c h 2 0 v a l u e c a n b e w r i t t e n / r e a d i n t h i s r e g i s t e r . t h i s v a l u e i s m a i n t a i n e d i n a l l t h e p o w e r s a v i n g m o d e s . t a b l e 2 2 . s c r a t c h p a d 3 s f r ( s c r a t c h 3 , 0 x f d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s c r a t c h 3 0 v a l u e c a n b e w r i t t e n / r e a d i n t h i s r e g i s t e r . t h i s v a l u e i s m a i n t a i n e d i n a l l t h e p o w e r s a v i n g m o d e s . t a b l e 2 3 . s c r a t c h p a d 4 s f r ( s c r a t c h 4 , 0 x f e ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s c r a t c h 4 0 v a l u e c a n b e w r i t t e n / r e a d i n t h i s r e g i s t e r . t h i s v a l u e i s m a i n t a i n e d i n a l l t h e p o w e r s a v i n g m o d e s . c l e a r i n g t h e s c r a t c h p a d r e g i s t e r s ( s c r a t c h 1 , 0 x f b t o s c r a t c h 4 , 0 x f e ) n o t e t h a t t h e s e s c r a t c h p a d r e g i s t e r s a r e o n l y c l e a r e d w h e n t h e p a r t l o s e s v d d a n d v b a t . t h e y a r e n o t c l e a r e d b y s o f t w a r e , w a t c h d o g , o r p l l r e s e t a n d , t h e r e f o r e , n e e d t o b e s e t c o r r e c t l y i n t h e s e s i t u a t i o n s . t a b l e 2 4 . p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r e s e r v e d 1 r e s e r v e d . 6 m e t e r _ o f f 0 s e t t h i s b i t t o t u r n o f f t h e m o d u l a t o r s a n d e n e r g y m e t e r i n g d s p c i r c u i t r y t o r e d u c e p o w e r i f m e t e r i n g f u n c t i o n s a r e n o t n e e d e d i n p s m 0 . 5 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t a t 0 f o r p r o p e r o p e r a t i o n . 4 c o r e o f f 0 s e t t h i s b i t t o s h u t d o w n t h e c o r e a n d e n t e r p s m 2 i f i n p s m 1 o p e r a t i n g m o d e . 3 r e s e r v e d 0 r e s e r v e d . 2 t o 0 c d [ 2 : 0 ] 0 1 0 c o n t r o l s t h e c o r e c l o c k f r e q u e n c y , f c o r e . f c o r e = 4 . 0 9 6 m h z / 2 c d . c d [ 2 : 0 ] r e s u l t ( f c o r e i n m h z ) 0 0 0 4 . 0 9 6 0 0 1 2 . 0 4 8 0 1 0 1 . 0 2 4 0 1 1 0 . 5 1 2 1 0 0 0 . 2 5 6 1 0 1 0 . 1 2 8 1 1 0 0 . 0 6 4 1 1 1 0 . 0 3 2 w r i t i n g t o t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) w r i t i n g d a t a t o t h e p o w c o n s f r i n v o l v e s w r i t i n g 0 x a 7 i n t o t h e k e y s f r ( k y r e g , 0 x c 1 ) , w h i c h i s d e s c r i b e d i n t a b l e 1 0 5 , f o l l o w e d b y a w r i t e t o t h e p o w c o n s f r . f o r e x a m p l e , m o v k y r e g , # 0 a 7 h ; w r i t e k y r e g t o 0 x a 7 t o g e t w r i t e a c c e s s t o t h e p o w c o n s f r m o v p o w c o n , # 1 0 h ; s h u t d o w n t h e c o r e
a d e 7 5 1 8 r e v . 0 | p a g e 2 5 o f 1 2 8 p o w e r s u p p l y a r c h i t e c t u r e t h e a d e 7 5 1 8 h a s t w o p o w e r s u p p l y i n p u t s , v d d a n d v b a t , a n d r e q u i r e s o n l y a s i n g l e 3 . 3 v p o w e r s u p p l y a t v d d f o r f u l l o p e r a t i o n . a b a t t e r y b a c k u p , o r s e c o n d a r y p o w e r s u p p l y , w i t h a m a x i m u m o f 3 . 7 v , c a n b e c o n n e c t e d t o t h e v b a t i n p u t . i n t e r n a l l y , t h e a d e 7 5 1 8 c o n n e c t s v d d o r v b a t t o v s w o u t , w h i c h i s u s e d t o d e r i v e p o w e r f o r t h e a d e 7 5 1 8 c i r c u i t r y . t h e v s w o u t o u t p u t p i n r e f l e c t s t h e v o l t a g e a t t h e i n t e r n a l p o w e r s u p p l y ( v s w o u t ) a n d h a s a m a x i m u m o u t p u t c u r r e n t o f 6 m a . t h i s p i n c a n a l s o b e u s e d t o p o w e r a l i m i t e d n u m b e r o f p e r i p h e r a l c o m p o n e n t s . t h e 2 . 5 v a n a l o g s u p p l y ( v i n t a ) a n d t h e 2 . 5 v s u p p l y f o r t h e c o r e l o g i c ( v i n t d ) a r e d e r i v e d b y o n - c h i p l i n e a r r e g u l a t o r s f r o m v s w o u t . f i g u r e 2 7 s h o w s t h e p o w e r s u p p l y a r c h i t e c t u r e o f a d e 7 5 1 8 . t h e a d e 7 5 1 8 p r o v i d e s a u t o m a t i c b a t t e r y s w i t c h o v e r b e t w e e n v d d a n d v b a t b a s e d o n t h e v o l t a g e l e v e l d e t e c t e d a t v d d o r v d c i n . a d d i t i o n a l l y , t h e b c t r l i n p u t c a n b e u s e d t o t r i g g e r a b a t t e r y s w i t c h o v e r . t h e c o n d i t i o n s f o r s w i t c h i n g v s w o u t f r o m v d d t o v b a t a n d b a c k t o v d d a r e d e s c r i b e d i n t h e b a t t e r y s w i t c h o v e r s e c t i o n . v d c i n i s a n i n p u t p i n t h a t c a n b e c o n n e c t e d t o a 0 v t o 3 . 3 v d c s i g n a l . t h i s i n p u t i s i n t e n d e d f o r p o w e r s u p p l y s u p e r - v i s o r y p u r p o s e s a n d d o e s n o t p r o v i d e p o w e r t o t h e a d e 7 5 1 8 c i r c u i t r y ( s e e t h e b a t t e r y s w i t c h o v e r s e c t i o n ) . p o w e r s u p p l y m a n a g e m e n t l d o v i n t d l d o v i n t a v s w s c r a t c h p a d l c d r t c 3 . 3 v m c u a d e s p i / i 2 c u a r t 2 . 5 v v d c i n v d d v b a t v s w o u t b c t r l 0 7 3 2 7 - 0 2 7 f i g u r e 2 7 . p o w e r s u p p l y a r c h i t e c t u r e b a t t e r y s w i t c h o v e r t h e a d e 7 5 1 8 m o n i t o r s v d d , v b a t , a n d v d c i n . a u t o m a t i c b a t t e r y s w i t c h o v e r f r o m v d d t o v b a t c a n b e c o n f i g u r e d b a s e d o n t h e s t a t u s o f t h e v d d , v d c i n , o r b c t r l p i n . b a t t e r y s w i t c h o v e r i s e n a b l e d b y d e f a u l t . s e t t i n g b i t 1 i n t h e b a t t e r y s w i t c h o v e r c o n f i g u - r a t i o n s f r ( b a t p r , 0 x f 5 ) d i s a b l e s b a t t e r y s w i t c h o v e r s o t h a t v d d i s a l w a y s c o n n e c t e d t o v s w o u t ( s e e t a b l e 1 7 ) . t h e s o u r c e o f v s w o u t i s i n d i c a t e d b y b i t 6 i n t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) , w h i c h i s d e s c r i b e d i n t a b l e 1 8 . b i t 6 i s s e t w h e n v s w o u t i s c o n n e c t e d t o v d d a n d c l e a r e d w h e n v s w o u t i s c o n n e c t e d t o v b a t . t h e b a t t e r y s w i t c h o v e r f u n c t i o n a l i t y p r o v i d e d b y t h e a d e 7 5 1 8 a l l o w s a s e a m l e s s t r a n s i t i o n f r o m v d d t o v b a t . a n a u t o m a t i c b a t t e r y s w i t c h o v e r o p t i o n e n s u r e s a s t a b l e p o w e r s u p p l y t o t h e a d e 7 5 1 8 , a s l o n g a s t h e e x t e r n a l b a t t e r y v o l t a g e i s a b o v e 2 . 7 5 v . i t a l l o w s c o n t i n u o u s c o d e e x e c u t i o n e v e n w h i l e t h e i n t e r n a l p o w e r s u p p l y i s s w i t c h i n g f r o m v d d t o v b a t a n d b a c k . n o t e t h a t t h e e n e r g y m e t e r i n g a d c s a r e n o t a v a i l a b l e w h e n v b a t i s b e i n g u s e d f o r v s w o u t . p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t s c a n b e e n a b l e d t o i n d i c a t e w h e n b a t t e r y s w i t c h o v e r o c c u r s a n d w h e n t h e v d d p o w e r s u p p l y i s r e s t o r e d ( s e e t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t s e c t i o n ) . v d d t o v b a t t h e f o l l o w i n g t h r e e e v e n t s s w i t c h t h e i n t e r n a l p o w e r s u p p l y ( v s w o u t ) f r o m v d d t o v b a t : x v d c i n < 1 . 2 v . w h e n v d c i n f a l l s b e l o w 1 . 2 v , v s w o u t s w i t c h e s f r o m v d d t o v b a t . t h i s e v e n t i s e n a b l e d w h e n t h e b a t p r g [ 1 : 0 ] b i t s i n t h e b a t t e r y s w i t c h o v e r c o n f i g u r a t i o n s f r ( b a t p r , 0 x f 5 ) = 0 b 0 1 . s e t t i n g t h e s e b i t s d i s a b l e s s w i t c h o v e r b a s e d o n v d c i n . b a t t e r y s w i t c h o v e r o n l o w v d c i n i s d i s a b l e d b y d e f a u l t . x v d d < 2 . 7 5 v . w h e n v d d f a l l s b e l o w 2 . 7 5 v , v s w o u t s w i t c h e s f r o m v d d t o v b a t . t h i s e v e n t i s e n a b l e d w h e n b a t p r g [ 1 : 0 ] i n t h e b a t p r s r f a r e c l e a r e d . x f a l l i n g e d g e o n b c t r l . w h e n t h e b a t t e r y c o n t r o l p i n , b c t r l , g o e s l o w , v s w o u t s w i t c h e s f r o m v d d t o v b a t . t h i s e x t e r n a l s w i t c h o v e r s i g n a l c a n t r i g g e r a s w i t c h o v e r t o v b a t a t a n y t i m e . s e t t i n g t h e b i t s i n t 1 p r g [ 2 : 0 ] t o 0 b x 0 1 i n t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) e n a b l e s t h e b a t t e r y c o n t r o l p i n ( s e e t a b l e 1 5 ) . s w i t c h i n g f r o m v b a t t o v d d t o s w i t c h v s w o u t f r o m v b a t t o v d d , a l l o f t h e f o l l o w i n g e v e n t s t h a t a r e e n a b l e d t o f o r c e b a t t e r y s w i t c h o v e r m u s t b e f a l s e : x v d c i n < 1 . 2 v a n d v d d < 2 . 7 5 v e n a b l e d . i f t h e l o w v d c i n c o n d i t i o n i s e n a b l e d , v s w o u t s w i t c h e s t o v d d a f t e r v d c i n r e m a i n s a b o v e 1 . 2 v a n d v d d r e m a i n s a b o v e 2 . 7 5 v . x v d d < 2 . 7 5 v e n a b l e d . v s w o u t s w i t c h e s b a c k t o v d d a f t e r v d d r e m a i n s a b o v e 2 . 7 5 v . x b c t r l e n a b l e d . v s w o u t s w i t c h e s b a c k t o v d d a f t e r b c t r l i s h i g h , a n d t h e f i r s t o r s e c o n d b u l l e t p o i n t i s s a t i s f i e d .
a d e 7 5 1 8 r e v . 0 | p a g e 2 6 o f 1 2 8 p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t a l e r t s t h e 8 0 5 2 c o r e o f p o w e r s u p p l y e v e n t s . t h e p s m i n t e r r u p t i s d i s a b l e d b y d e f a u l t . s e t t i n g t h e e p s m b i t i n t h e i n t e r r u p t e n a b l e a n d p r i o r i t y 2 s f r ( i e i p 2 , 0 x a 9 ) e n a b l e s t h e p s m i n t e r r u p t ( s e e t a b l e 6 0 ) . t h e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) c o n t r o l s t h e e v e n t s t h a t r e s u l t i n a p s m i n t e r r u p t ( s e e t a b l e 1 9 ) . f i g u r e 2 8 i s a d i a g r a m i l l u s t r a t i n g h o w t h e p s m i n t e r r u p t v e c t o r i s s h a r e d a m o n g t h e p s m i n t e r r u p t s o u r c e s . t h e p s m i n t e r r u p t f l a g s a r e l a t c h e d a n d m u s t b e c l e a r e d b y w r i t i n g t o t h e i p s m f f l a g r e g i s t e r ( s e e t a b l e 1 6 ) . r e s e r v e d r e s e r v e d r e s e r v e d r e s e r v e d e p s r f p s r e s a g f s a g e b s o f b s o e v d c i n f v d c i n f p s m e p s m t r u e ? p e n d i n g p s m i n t e r r u p t e p s r r e s e r v e d e s a g r e s e r v e d e b s o e v d c i n f p s r f p s m f s a g r e s e r v e d f b s o f v d c i n r e s e r v e d p t i r e s e r v e d p s i e a d e e t i e p s m e s i i p s m e a d d r . 0 x e c i p s m f a d d r . 0 x f 8 i e i p 2 a d d r . 0 x a 9 n o t i n v o l v e d i n p s m i n t e r r u p t s i g n a l c h a i n 0 7 3 2 7 - 0 2 8 f i g u r e 2 8 . p s m i n t e r r u p t s o u r c e s
a d e 7 5 1 8 r e v . 0 | p a g e 2 7 o f 1 2 8 b a t t e r y s w i t c h o v e r a n d p o w e r s u p p l y r e s t o r e d p s m i n t e r r u p t t h e a d e 7 5 1 8 c a n b e c o n f i g u r e d t o g e n e r a t e a p s m i n t e r r u p t w h e n t h e s o u r c e o f v s w o u t c h a n g e s f r o m v d d t o v b a t , i n d i c a t i n g b a t t e r y s w i t c h o v e r . s e t t i n g t h e e b s o b i t i n t h e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) e n a b l e s t h i s e v e n t t o g e n e r a t e a p s m i n t e r r u p t ( s e e t a b l e 1 9 ) . t h e a d e 7 5 1 8 c a n a l s o b e c o n f i g u r e d t o g e n e r a t e a n i n t e r r u p t w h e n t h e s o u r c e o f v s w o u t c h a n g e s f r o m v b a t t o v d d , i n d i c a t i n g t h a t t h e v d d p o w e r s u p p l y h a s b e e n r e s t o r e d . s e t t i n g t h e e p s r b i t i n t h e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) e n a b l e s t h i s e v e n t t o g e n e r a t e a p s m i n t e r r u p t . t h e f l a g s i n t h e i p s m f s f r f o r t h e s e i n t e r r u p t s , f b s o a n d f p s r , a r e s e t r e g a r d l e s s o f w h e t h e r t h e r e s p e c t i v e e n a b l e b i t s h a v e b e e n s e t . t h e b a t t e r y s w i t c h o v e r a n d p o w e r s u p p l y r e s t o r e e v e n t f l a g s , f b s o a n d f p s r , a r e l a t c h e d . t h e s e e v e n t s m u s t b e c l e a r e d b y w r i t i n g 0 t o t h e s e b i t s . b i t 6 i n t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) , v s w s o u r c e , t r a c k s t h e s o u r c e o f v s w o u t . t h e b i t i s s e t w h e n v s w o u t i s c o n n e c t e d t o v d d a n d c l e a r e d w h e n v s w o u t i s c o n n e c t e d t o v b a t . v d c i n m o n i t o r p s m i n t e r r u p t t h e v d c i n v o l t a g e i s m o n i t o r e d b y a c o m p a r a t o r . t h e f v d c i n b i t i n t h e p o w e r m a n a g e m e n t i n t e r r u p t f l a g s f r ( i p s m f , 0 x f 8 ) i s s e t w h e n t h e v d c i n i n p u t l e v e l i s l o w e r t h a n 1 . 2 v . s e t t i n g t h e e v d c i n b i t i n t h e i p s m e s f r e n a b l e s t h i s e v e n t t o g e n e r a t e a p s m i n t e r r u p t . t h i s e v e n t , w h i c h i s a s s o c i a t e d w i t h t h e s a g m o n i t o r i n g , c a n b e u s e d t o d e t e c t a p o w e r s u p p l y ( v d d ) b e i n g c o m p r o m i s e d a n d t o t r i g g e r f u r t h e r a c t i o n s p r i o r t o d e c i d i n g a s w i t c h o f v d d t o v b a t . s a g m o n i t o r p s m i n t e r r u p t t h e a d e 7 5 1 8 e n e r g y m e a s u r e m e n t d s p m o n i t o r s t h e a c v o l t a g e i n p u t a t t h e v p a n d v n i n p u t p i n s . t h e s a g l v l r e g i s t e r i s u s e d t o s e t t h e t h r e s h o l d f o r a l i n e v o l t a g e s a g e v e n t . t h e f s a g b i t i n t h e p o w e r m a n a g e m e n t i n t e r r u p t f l a g s f r ( i p s m f , 0 x f 8 ) i s s e t i f t h e l i n e v o l t a g e s t a y s b e l o w t h e l e v e l s e t i n t h e s a g l v l r e g i s t e r f o r t h e n u m b e r o f l i n e c y c l e s s e t i n t h e s a g c y c r e g i s t e r . s e e t h e l i n e v o l t a g e s a g d e t e c t i o n s e c t i o n f o r m o r e i n f o r m a - t i o n . s e t t i n g t h e e s a g b i t i n t h e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) e n a b l e s t h i s e v e n t t o g e n e r a t e a p s m i n t e r r u p t .
a d e 7 5 1 8 r e v . 0 | p a g e 2 8 o f 1 2 8 u s i n g t h e p o w e r s u p p l y f e a t u r e s i n a n e n e r g y m e t e r a p p l i c a t i o n , t h e 3 . 3 v p o w e r s u p p l y ( v d d ) i s t y p i c a l l y g e n e r a t e d f r o m t h e a c l i n e v o l t a g e a n d r e g u l a t e d t o 3 . 3 v b y a v o l t a g e r e g u l a t o r i c . t h e p r e r e g u l a t e d d c v o l t a g e , t y p i c a l l y 5 v t o 1 2 v , c a n b e c o n n e c t e d t o v d c i n t h r o u g h a r e s i s - t o r d i v i d e r . a 3 . 6 v b a t t e r y c a n b e c o n n e c t e d t o v b a t . f i g u r e 2 9 s h o w s h o w t h e a d e 7 5 1 8 p o w e r s u p p l y i n p u t s a r e s e t u p i n t h i s a p p l i c a t i o n . f i g u r e 3 0 s h o w s t h e s e q u e n c e o f e v e n t s t h a t o c c u r s i f t h e m a i n p o w e r s u p p l y g e n e r a t e d b y t h e p s u s t a r t s t o f a i l i n t h e p o w e r m e t e r a p p l i c a t i o n s h o w n i n f i g u r e 2 9 . t h e s a g d e t e c t i o n c a n p r o v i d e t h e e a r l i e s t w a r n i n g o f a p o t e n t i a l p r o b l e m o n v d d . w h e n a s a g e v e n t o c c u r s , u s e r c o d e c a n b e c o n f i g u r e d t o b a c k u p d a t a a n d p r e p a r e f o r b a t t e r y s w i t c h o v e r i f d e s i r e d . t h e r e l a - t i v e s p a c i n g o f t h e s e i n t e r r u p t s d e p e n d s o n t h e d e s i g n o f t h e p o w e r s u p p l y . f i g u r e 3 1 s h o w s t h e s e q u e n c e o f e v e n t s t h a t o c c u r s i f t h e m a i n p o w e r s u p p l y s t a r t s t o f a i l i n t h e p o w e r m e t e r a p p l i c a t i o n s h o w n i n f i g u r e 2 9 , w i t h b a t t e r y s w i t c h o v e r o n l o w v d c i n o r l o w v d d e n a b l e d . f i n a l l y , t h e t r a n s i t i o n b e t w e e n v d d a n d v b a t a n d t h e d i f f e r e n t p o w e r s u p p l y m o d e s ( s e e t h e o p e r a t i n g m o d e s s e c t i o n ) a r e r e p r e s e n t e d i n f i g u r e 3 2 a n d f i g u r e 3 3 . v o l t a g e s u p e r v i s o r y p o w e r s u p p l y m a n a g e m e n t i p s m f s f r ( a d d r . 0 x f 8 ) v s w v b a t v s w o u t v d d 5 8 6 1 6 0 v o l t a g e s u p e r v i s o r y 6 4 v d c i n 3 . 3 v r e g u l a t o r 5 v t o 1 2 v d c p s u 5 0 s a g d e t e c t i o n 4 9 4 5 b c t r l v p v n ( 2 4 0 v , 2 2 0 v , 1 1 0 v t y p i c a l ) a c i n p u t 0 7 3 2 7 - 0 2 9 f i g u r e 2 9 . p o w e r s u p p l y m a n a g e m e n t f o r e n e r g y m e t e r a p p l i c a t i o n t 1 t 2 v d d v d c i n v p ? v n 2 . 7 5 v 1 . 2 v s a g l e v e l t r i p p o i n t s a g c y c = 1 s a g e v e n t ( f s a g = 1 ) v d c i n e v e n t ( f v d c i n = 1 ) i f s w i t c h o v e r o n l o w v d d i s e n a b l e d , a u t o m a t i c b a t t e r y s w i t c h o v e r v s w o u t c o n n e c t e d t o v b a t b s o e v e n t ( f b s o = 1 ) 0 7 3 2 7 - 0 3 0 f i g u r e 3 0 . p o w e r s u p p l y m a n a g e m e n t i n t e r r u p t s a n d b a t t e r y s w i t c h o v e r w i t h o n l y v d d e n a b l e d f o r b a t t e r y s w i t c h o v e r
a d e 7 5 1 8 r e v . 0 | p a g e 2 9 o f 1 2 8 t a b l e 2 5 . p o w e r s u p p l y e v e n t t i m i n g o p e r a t i n g m o d e s p a r a m e t e r t i m e d e s c r i p t i o n t 1 1 0 n s m i n t i m e b e t w e e n w h e n v d c i n f a l l s b e l o w 1 . 2 v a n d w h e n f v d c i n i s r a i s e d . t 2 1 0 n s m i n t i m e b e t w e e n w h e n v d d f a l l s b e l o w 2 . 7 5 v a n d w h e n b a t t e r y s w i t c h o v e r o c c u r s . t 3 3 0 m s t y p t i m e b e t w e e n w h e n v d c i n f a l l s b e l o w 1 . 2 v a n d w h e n b a t t e r y s w i t c h o v e r o c c u r s i f v d c i n i s e n a b l e d t o c a u s e b a t t e r y s w i t c h o v e r . t 4 1 3 0 m s t y p t i m e b e t w e e n w h e n p o w e r s u p p l y r e s t o r e c o n d i t i o n s a r e m e t ( v d c i n a b o v e 1 . 2 v a n d v d d a b o v e 2 . 7 5 v i f b a t p r [ 1 : 0 ] = 0 b 0 1 o r v d d a b o v e 2 . 7 5 v i f b a t p r [ 1 : 0 ] = 0 b 0 0 ) a n d w h e n v s w o u t s w i t c h e s t o v d d . t 1 t 3 v d d v d c i n v p ? v n 2 . 7 5 v 1 . 2 v s a g l e v e l t r i p p o i n t s a g c y c = 1 s a g e v e n t ( f s a g = 1 ) v d c i n e v e n t ( f v d c i n = 1 ) i f s w i t c h o v e r o n l o w v d c i n i s e n a b l e d , a u t o m a t i c b a t t e r y s w i t c h o v e r v s w o u t c o n n e c t e d t o v b a t b s o e v e n t ( f b s o = 1 ) 0 7 3 2 7 - 0 3 1 f i g u r e 3 1 . p o w e r s u p p l y m a n a g e m e n t i n t e r r u p t s a n d b a t t e r y s w i t c h o v e r w i t h v d d o r v d c i n e n a b l e d f o r b a t t e r y s w i t c h o v e r v p v n s a g l e v e l t r i p p o i n t s a g e v e n t v d c i n 1 . 2 v 3 0 m s m i n 1 3 0 m s m i n v d c i n e v e n t v d c i n e v e n t v b a t v d d 2 . 7 5 v v s w b a t t e r y s w i t c h e n a b l e d o n l o w v d c i n v s w b a t t e r y s w i t c h e n a b l e d o n l o w v d d p s m 0 p s m 0 p s m 0 p s m 0 p s m 1 o r p s m 2 p s m 1 o r p s m 2 0 7 3 2 7 - 0 3 2 f i g u r e 3 2 . p o w e r s u p p l y m a n a g e m e n t t r a n s i t i o n s b e t w e e n m o d e s
a d e 7 5 1 8 r e v . 0 | p a g e 3 0 o f 1 2 8 o p e r a t i n g m o d e s p s m 0 ( n o r m a l m o d e ) i n p s m 0 , n o r m a l o p e r a t i n g m o d e , v s w o u t i s c o n n e c t e d t o v d d . a l l o f t h e a n a l o g c i r c u i t r y a n d d i g i t a l c i r c u i t r y p o w e r e d b y v i n t d a n d v i n t a a r e e n a b l e d b y d e f a u l t . i n n o r m a l m o d e , t h e d e f a u l t c l o c k f r e q u e n c y , f c o r e , e s t a b l i s h e d d u r i n g a p o w e r - o n r e s e t o r s o f t w a r e r e s e t , i s 1 . 0 2 4 m h z . p s m 1 ( b a t t e r y m o d e ) i n p s m 1 , b a t t e r y m o d e , v s w o u t i s c o n n e c t e d t o v b a t . i n t h i s o p e r a t i n g m o d e , t h e 8 0 5 2 c o r e a n d a l l o f t h e d i g i t a l c i r c u i t r y a r e e n a b l e d b y d e f a u l t . t h e a n a l o g c i r c u i t r y f o r t h e a d e e n e r g y m e t e r i n g d s p p o w e r e d b y v i n t a i s d i s a b l e d . t h i s a n a l o g c i r c u i t r y a u t o m a t i c a l l y r e s t a r t s , a n d t h e s w i t c h t o t h e v d d p o w e r s u p p l y o c c u r s w h e n t h e v d d s u p p l y i s a b o v e 2 . 7 5 v a n d t h e p w r d n b i t i n t h e m o d e 1 r e g i s t e r ( 0 x 0 b ) i s c l e a r e d ( s e e t a b l e 3 1 ) . t h e d e f a u l t f c o r e f o r p s m 1 , e s t a b l i s h e d d u r i n g a p o w e r - o n r e s e t o r s o f t w a r e r e s e t , i s 1 . 0 2 4 m h z . p s m 2 ( s l e e p m o d e ) p s m 2 i s a l o w p o w e r c o n s u m p t i o n s l e e p m o d e f o r u s e i n b a t t e r y o p e r a t i o n . i n t h i s m o d e , v s w o u t i s c o n n e c t e d t o v b a t . a l l o f t h e 2 . 5 v d i g i t a l a n d a n a l o g c i r c u i t r y p o w e r e d t h r o u g h v i n t a a n d v i n t d a r e d i s a b l e d , i n c l u d i n g t h e m c u c o r e , r e s u l t i n g i n t h e f o l l o w i n g : x t h e r a m i n t h e m c u i s n o l o n g e r v a l i d . x t h e p r o g r a m c o u n t e r f o r t h e 8 0 5 2 , a l s o h e l d i n v o l a t i l e m e m o r y , b e c o m e s i n v a l i d w h e n t h e 2 . 5 v s u p p l y i s s h u t d o w n . t h e r e f o r e , t h e p r o g r a m d o e s n o t r e s u m e f r o m w h e r e i t l e f t o f f b u t a l w a y s s t a r t s f r o m t h e p o w e r - o n r e s e t v e c t o r w h e n t h e a d e 7 5 1 8 e x i t s p s m 2 . t h e 3 . 3 v p e r i p h e r a l s ( r t c , a n d l c d ) a r e a c t i v e i n p s m 2 . t h e y c a n b e e n a b l e d o r d i s a b l e d t o r e d u c e p o w e r c o n s u m p t i o n a n d a r e c o n f i g u r e d f o r p s m 2 o p e r a t i o n w h e n t h e m c u c o r e i s a c t i v e ( s e e t a b l e 2 7 f o r m o r e i n f o r m a t i o n a b o u t t h e i n d i v i d u a l p e r i p h e r a l s a n d t h e i r p s m 2 c o n f i g u r a t i o n ) . t h e a d e 7 5 1 8 r e m a i n s i n p s m 2 u n t i l a n e v e n t o c c u r s t o w a k e t h e m u p . i n p s m 2 , t h e a d e 7 5 1 8 p r o v i d e s f o u r s c r a t c h p a d r a m s f r s t h a t a r e m a i n t a i n e d d u r i n g t h i s m o d e . t h e s e s f r s c a n b e u s e d t o s a v e d a t a f r o m p s m 0 o r p s m 1 w h e n e n t e r i n g p s m 2 ( s e e t a b l e 2 0 t o t a b l e 2 3 ) . i n p s m 2 , t h e a d e 7 5 1 8 m a i n t a i n s s o m e s f r s ( s e e t a b l e 2 6 ) . t h e s f r s t h a t a r e n o t l i s t e d i n t h i s t a b l e s h o u l d b e r e s t o r e d w h e n t h e p a r t e n t e r s p s m 0 o r p s m 1 f r o m p s m 2 . t a b l e 2 6 . s f r s m a i n t a i n e d i n p s m 2 i / o c o n f i g u r a t i o n p o w e r s u p p l y m a n a g e m e n t r t c p e r i p h e r a l s l c d p e r i p h e r a l s i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) , s e e t a b l e 1 5 b a t t e r y s w i t c h o v e r c o n f i g u r a t i o n s f r ( b a t p r , 0 x f 5 ) , s e e t a b l e 1 7 r t c n o m i n a l c o m p e n s a t i o n s f r ( r t c c o m p , 0 x f 6 ) , s e e t a b l e 1 1 5 l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) , s e e t a b l e 7 7 p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) , s e e t a b l e 1 8 r t c t e m p e r a t u r e c o m p e n s a t i o n s f r ( t e m p c a l , 0 x f 7 ) , s e e t a b l e 1 1 6 l c d c o n f i g u r a t i o n y s f r ( l c d c o n y , 0 x b 1 ) , s e e t a b l e 7 0 p o r t 0 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 0 , 0 x b 2 ) , s e e t a b l e 1 3 8 r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) , s e e t a b l e 1 0 9 l c d c o n f i g u r a t i o n x s f r ( l c d c o n x , 0 x 9 c ) , s e e t a b l e 6 9 p o r t 1 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 1 , 0 x b 3 ) , s e e t a b l e 1 3 9 h u n d r e d t h s o f a s e c o n d c o u n t e r s f r ( h t h s e c , 0 x a 2 ) , s e e t a b l e 1 1 0 l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) , s e e t a b l e 6 8 p o r t 2 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 2 , 0 x b 4 ) , s e e t a b l e 1 4 0 s e c o n d s c o u n t e r s f r ( s e c , 0 x a 3 ) , s e e t a b l e 1 1 1 l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) , s e e t a b l e 7 1 s c r a t c h p a d 1 s f r ( s c r a t c h 1 , 0 x f b ) , s e e t a b l e 2 0 m i n u t e s c o u n t e r s f r ( m i n , 0 x a 4 ) , s e e t a b l e 1 1 2 l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) , s e e t a b l e 7 4 s c r a t c h p a d 2 s f r ( s c r a t c h 2 , 0 x f c ) , s e e t a b l e 2 1 h o u r s c o u n t e r s f r ( h o u r , 0 x a 5 ) , s e e t a b l e 1 1 3 l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) , s e e t a b l e 7 5 s c r a t c h p a d 3 s f r ( s c r a t c h 3 , 0 x f d ) , s e e t a b l e 2 2 a l a r m i n t e r v a l s f r ( i n t v a l , 0 x a 6 ) , s e e t a b l e 1 1 4 l c d d a t a s f r ( l c d d a t , 0 x a e ) , s e e t a b l e 7 6 s c r a t c h p a d 4 s f r ( s c r a t c h 4 , 0 x f e ) , s e e t a b l e 2 3
a d e 7 5 1 8 r e v . 0 | p a g e 3 1 o f 1 2 8 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s s o m e o f t h e 3 . 3 v p e r i p h e r a l s a r e c a p a b l e o f w a k i n g t h e a d e 7 5 1 8 f r o m p s m 2 . t h e e v e n t s t h a t c a n c a u s e t h e a d e 7 5 1 8 t o w a k e u p f r o m p s m 2 a r e l i s t e d i n t h e w a k e - u p e v e n t c o l u m n i n t a b l e 2 7 . t h e i n t e r r u p t f l a g a s s o c i a t e d w i t h t h e s e e v e n t s m u s t b e c l e a r e d p r i o r t o e x e c u t i n g i n s t r u c t i o n s t h a t p u t t h e a d e 7 5 1 8 i n p s m 2 m o d e a f t e r w a k e - u p . t a b l e 2 7 . 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s 3 . 3 v p e r i p h e r a l w a k e - u p e v e n t w a k e - u p e n a b l e b i t s f l a g i n t e r r u p t v e c t o r c o m m e n t s p o w e r s u p p l y m a n a g e m e n t p s r n o n m a s k a b l e p s r i p s m t h e a d e 7 5 1 8 w a k e s u p i f t h e p o w e r s u p p l y i s r e s t o r e d ( i f v s w o u t s w i t c h e s t o b e c o n n e c t e d t o v d d ) . t h e v s w s o u r c e f l a g , b i t 6 o f t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) , i s s e t t o i n d i c a t e t h a t v s w o u t i s c o n n e c t e d t o v d d . r t c m i d n i g h t n o n m a s k a b l e m i d n i g h t i r t c t h e a d e 7 5 1 8 w a k e s u p a t m i d n i g h t e v e r y d a y t o u p d a t e i t s c a l e n d a r s . t h e r t c i n t e r r u p t n e e d s t o b e s e r v i c e d a n d a c k n o w l e d g e d p r i o r t o e n t e r i n g p s m 2 m o d e . a l a r m m a s k a b l e a l a r m i r t c a n a l a r m c a n b e s e t t o w a k e t h e a d e 7 5 1 8 a f t e r t h e d e s i r e d a m o u n t o f t i m e . t h e r t c a l a r m i s e n a b l e d b y s e t t i n g t h e a l a r m b i t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) . t h e r t c i n t e r r u p t n e e d s t o b e s e r v i c e d a n d a c k n o w l e d g e d p r i o r t o e n t e r i n g p s m 2 m o d e . i / o p o r t s 1 i n t 0 i n t 0 p r g = 1 i e 0 t h e e d g e o f t h e i n t e r r u p t i s s e l e c t e d b y b i t i t 0 i n t h e t c o n r e g i s t e r . t h e i e 0 f l a g b i t i n t h e t c o n r e g i s t e r i s n o t a f f e c t e d . t h e i n t e r r u p t 0 i n t e r r u p t n e e d s t o b e s e r v i c e d a n d a c k n o w l e d g e d p r i o r t o e n t e r i n g p s m 2 m o d e . i n t 1 i n t 1 p r g [ 2 : 0 ] = 1 1 x i e 1 t h e e d g e o f t h e i n t e r r u p t i s s e l e c t e d b y b i t i t 1 i n t h e t c o n r e g i s t e r . t h e i e 1 f l a g b i t i n t h e t c o n r e g i s t e r i s n o t a f f e c t e d . t h e i n t e r r u p t 1 i n t e r r u p t n e e d s t o b e s e r v i c e d a n d a c k n o w l e d g e d p r i o r t o e n t e r i n g p s m 2 m o d e . r x e d g e r x p r o g [ 1 : 0 ] = 1 1 p e r i p h [ 7 ] ( r x f l a g ) a n r x e d g e e v e n t o c c u r s i f a r i s i n g o r f a l l i n g e d g e i s d e t e c t e d o n t h e r x l i n e . t h e u a r t r x d f l a g n e e d s t o b e c l e a r e d p r i o r t o e n t e r i n g p s m 2 m o d e . e x t e r n a l r e s e t r e s e t n o n m a s k a b l e i f t h e r e s e t p i n i s b r o u g h t l o w w h i l e t h e a d e 7 5 1 8 i s i n p s m 2 , t h e a d e 7 5 1 8 w a k e s u p t o p s m 1 . l c d t h e l c d c a n b e e n a b l e d / d i s a b l e d i n p s m 2 . t h e l c d d a t a m e m o r y r e m a i n s i n t a c t . s c r a t c h p a d t h e f o u r s c r a t c h x r e g i s t e r s r e m a i n i n t a c t i n p s m 2 . 1 a l l i / o p i n s a r e t r e a t e d a s i n p u t s . t h e w e a k p u l l - u p o n e a c h i / o p i n c a n b e d i s a b l e d i n d i v i d u a l l y i n t h e p o r t 0 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 0 , 0 x b 2 ) , p o r t 1 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 1 , 0 x b 3 ) , a n d p o r t 2 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 2 , 0 x b 4 ) t o d e c r e a s e c u r r e n t c o n s u m p t i o n . t h e i n t e r r u p t s c a n b e e n a b l e d / d i s a b l e d .
a d e 7 5 1 8 r e v . 0 | p a g e 3 2 o f 1 2 8 t r a n s i t i o n i n g b e t w e e n o p e r a t i n g m o d e s t h e o p e r a t i n g m o d e o f t h e a d e 7 5 1 8 i s d e t e r m i n e d b y t h e p o w e r s u p p l y c o n n e c t e d t o v s w o u t . t h e r e f o r e , c h a n g e s i n t h e p o w e r s u p p l y , s u c h a s w h e n v s w o u t s w i t c h e s f r o m v d d t o v b a t o r w h e n v s w o u t s w i t c h e s t o v d d , a l t e r t h e o p e r a t i n g m o d e . t h i s s e c t i o n d e s c r i b e s e v e n t s t h a t c h a n g e t h e o p e r a t i n g m o d e . a u t o m a t i c b a t t e r y s w i t c h o v e r ( p s m 0 t o p s m 1 ) i f a n y o f t h e e n a b l e d b a t t e r y s w i t c h o v e r e v e n t s o c c u r ( s e e t h e b a t t e r y s w i t c h o v e r s e c t i o n ) , v s w o u t s w i t c h e s t o v b a t . t h i s s w i t c h - o v e r r e s u l t s i n a t r a n s i t i o n f r o m t h e p s m 0 t o p s m 1 o p e r a t i n g m o d e . w h e n b a t t e r y s w i t c h o v e r o c c u r s , t h e a n a l o g c i r c u i t r y u s e d i n t h e a d e e n e r g y m e a s u r e m e n t d s p i s d i s a b l e d . t o r e d u c e p o w e r c o n s u m p t i o n , t h e u s e r c o d e c a n i n i t i a t e a t r a n s i t i o n t o p s m 2 . e n t e r i n g s l e e p m o d e ( p s m 1 t o p s m 2 ) t o r e d u c e p o w e r c o n s u m p t i o n w h e n v s w o u t i s c o n n e c t e d t o v b a t , u s e r c o d e c a n i n i t i a t e s l e e p m o d e , p s m 2 , b y s e t t i n g b i t 4 i n t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) t o s h u t d o w n t h e m c u c o r e . e v e n t s c a p a b l e o f w a k i n g t h e m c u c a n b e e n a b l e d ( s e e t h e 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s s e c t i o n ) . s e r v i c i n g w a k e - u p e v e n t s ( p s m 2 t o p s m 1 ) t h e a d e 7 5 1 8 m a y n e e d t o w a k e u p f r o m p s m 2 t o s e r v i c e w a k e - u p e v e n t s ( s e e t h e 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s s e c t i o n ) . p s m 1 c o d e e x e c u t i o n b e g i n s a t t h e p o w e r - o n r e s e t v e c t o r . a f t e r s e r v i c i n g t h e w a k e - u p e v e n t , t h e a d e 7 5 1 8 c a n b e r e t u r n e d t o p s m 2 b y s e t t i n g b i t 4 i n t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) t o s h u t d o w n t h e m c u c o r e . a u t o m a t i c s w i t c h t o v d d ( p s m 2 t o p s m 0 ) i f t h e c o n d i t i o n s t o s w i t c h v s w o u t f r o m v b a t t o v d d o c c u r ( s e e t h e b a t t e r y s w i t c h o v e r s e c t i o n ) , t h e o p e r a t i n g m o d e s w i t c h e s t o p s m 0 . w h e n t h i s s w i t c h o c c u r s , t h e m c u c o r e a n d t h e a n a l o g c i r c u i t r y u s e d i n t h e a d e e n e r g y m e a s u r e m e n t d s p a u t o m a t i c a l l y r e s t a r t . p s m 0 c o d e e x e c u t i o n b e g i n s a t t h e p o w e r - o n r e s e t v e c t o r . a u t o m a t i c s w i t c h t o v d d ( p s m 1 t o p s m 0 ) i f t h e c o n d i t i o n s t o s w i t c h v s w o u t f r o m v b a t t o v d d o c c u r ( s e e t h e b a t t e r y s w i t c h o v e r s e c t i o n ) , t h e o p e r a t i n g m o d e s w i t c h e s t o p s m 0 . w h e n t h i s s w i t c h o c c u r s , t h e a n a l o g c i r c u i t r y u s e d i n t h e a d e e n e r g y m e a s u r e m e n t d s p a u t o m a t i c a l l y r e s t a r t s . n o t e t h a t n o r m a l c o d e e x e c u t i o n c o n t i n u e s . a s o f t w a r e r e s e t c a n b e p e r - f o r m e d t o s t a r t p s m 0 c o d e e x e c u t i o n a t t h e p o w e r - o n r e s e t v e c t o r . u s i n g t h e p o w e r m a n a g e m e n t f e a t u r e s b e c a u s e p r o g r a m f l o w i s d i f f e r e n t f o r e a c h o p e r a t i n g m o d e , t h e s t a t u s o f v s w o u t m u s t b e k n o w n a t a l l t i m e s . t h e v s w s o u r c e b i t i n t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) i n d i c a t e s w h a t v s w o u t i s c o n n e c t e d t o ( s e e t a b l e 1 8 ) . t h i s b i t c a n b e u s e d t o c o n t r o l p r o g r a m f l o w o n w a k e - u p . b e c a u s e c o d e e x e c u t i o n a l w a y s s t a r t s a t t h e p o w e r - o n r e s e t v e c t o r , b i t 6 o f t h e p e r i p h s r f c a n b e t e s t e d t o d e t e r m i n e w h i c h p o w e r s u p p l y i s b e i n g u s e d a n d t o b r a n c h t o n o r m a l c o d e e x e c u t i o n o r t o w a k e u p e v e n t c o d e e x e c u t i o n . p o w e r s u p p l y e v e n t s c a n a l s o o c c u r w h e n t h e m c u c o r e i s a c t i v e . t o b e a w a r e o f t h e e v e n t s t h a t c h a n g e w h a t v s w o u t i s c o n n e c t e d t o , u s e t h e f o l l o w i n g g u i d e l i n e s : x e n a b l e t h e b a t t e r y s w i t c h o v e r i n t e r r u p t ( e b s o ) i f v s w o u t = v d d a t p o w e r - u p . x e n a b l e t h e p o w e r s u p p l y r e s t o r e d i n t e r r u p t ( e p s r ) i f v s w o u t = v b a t a t p o w e r - u p . a n e a r l y w a r n i n g t h a t b a t t e r y s w i t c h o v e r i s a b o u t t o o c c u r i s p r o v i d e d b y s a g d e t e c t i o n a n d p o s s i b l y l o w v d c i n d e t e c t i o n ( s e e t h e b a t t e r y s w i t c h o v e r s e c t i o n ) . f o r a u s e r - c o n t r o l l e d b a t t e r y s w i t c h o v e r , e n a b l e a u t o m a t i c b a t t e r y s w i t c h o v e r o n l o w v d d o n l y . t h e n , e n a b l e t h e l o w v d c i n e v e n t t o g e n e r a t e t h e p s m i n t e r r u p t . w h e n a l o w v d c i n e v e n t o c c u r s , s t a r t d a t a b a c k u p . u p o n c o m p l e t i o n o f t h e d a t a b a c k u p , e n a b l e b a t t e r y s w i t c h o v e r o n l o w v d c i n . b a t t e r y s w i t c h o v e r o c c u r s 3 0 m s l a t e r . p s m 1 b a t t e r y m o d e v s w o u t c o n n e c t e d t o v b a t p s m 0 n o r m a l m o d e v s w o u t c o n n e c t e d t o v d d p s m 2 s l e e p m o d e v s w o u t c o n n e c t e d t o v b a t p o w e r s u p p l y r e s t o r e d a u t o m a t i c b a t t e r y s w i t c h o v e r w a k e - u p e v e n t u s e r c o d e d i r e c t s m c u t o s h u t d o w n c o r e a f t e r s e r v i c i n g w a k e - u p e v e n t p o w e r s u p p l y r e s t o r e d 0 7 3 2 7 - 0 3 3 f i g u r e 3 3 . t r a n s i t i o n i n g b e t w e e n o p e r a t i n g m o d e s
a d e 7 5 1 8 r e v . 0 | p a g e 3 3 o f 1 2 8 e n e r g y m e a s u r e m e n t t h e a d e 7 5 1 8 o f f e r s a f i x e d f u n c t i o n , e n e r g y m e a s u r e m e n t , d i g i t a l p r o c e s s i n g c o r e t h a t p r o v i d e s a l l t h e i n f o r m a t i o n n e e d e d t o m e a s u r e e n e r g y i n s i n g l e - p h a s e e n e r g y m e t e r s . t h e p a r t p r o v i d e s t w o w a y s t o a c c e s s t h e e n e r g y m e a s u r e m e n t s : d i r e c t a c c e s s t h r o u g h s f r s f o r t i m e s e n s i t i v e i n f o r m a t i o n a n d i n d i r e c t a c c e s s t h r o u g h a d d r e s s a n d d a t a s f r r e g i s t e r s f o r t h e m a j o r i t y o f e n e r g y m e a s u r e m e n t s . t h e i r m s , v r m s , i n t e r r u p t s , a n d w a v e f o r m r e g i s t e r s a r e r e a d i l y a v a i l a b l e t h r o u g h s f r s , a s s h o w n i n t a b l e 2 9 . o t h e r e n e r g y m e a s u r e m e n t i n f o r m a t i o n i s m a p p e d t o a p a g e o f m e m o r y t h a t i s a c c e s s e d i n d i r e c t l y t h r o u g h t h e m a d d p t , m d a t l , m d a t m , a n d m d a t h s f r s . t h e a d d r e s s a n d d a t a r e g i s t e r s a c t a s p o i n t e r s t o t h e e n e r g y m e a s u r e m e n t i n t e r n a l r e g i s t e r s . a c c e s s t o e n e r g y m e a s u r e m e n t s f r s a c c e s s t o t h e e n e r g y m e a s u r e m e n t s f r s i s a c h i e v e d b y r e a d i n g o r w r i t i n g t o t h e s f r a d d r e s s e s d e t a i l e d i n t a b l e 2 9 . t h e i n t e r n a l d a t a f o r t h e m i r q x s f r s a r e l a t c h e d b y t e b y b y t e i n t o t h e s f r w h e n t h e s f r i s r e a d . t h e w a v 1 x , w a v 2 x , v r m s x , a n d i r m s x r e g i s t e r s a r e a l l 3 - b y t e s f r s . t h e 2 4 - b i t d a t a i s l a t c h e d i n t o t h e s e s f r s w h e n t h e h i g h b y t e i s r e a d . r e a d i n g t h e l o w o r m e d i u m b y t e b e f o r e t h e h i g h b y t e r e s u l t s i n r e a d i n g t h e d a t a f r o m t h e p r e v i o u s l a t c h e d s a m p l e . s a m p l e c o d e t o r e a d t h e v r m s x r e g i s t e r i s a s f o l l o w s : m o v r 1 , v r m s h ; l a t c h e s d a t a i n v r m s h , v r m s m , a n d v r m s l s f r s m o v r 2 , v r m s m m o v r 3 , v r m s l a c c e s s t o i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s a c c e s s t o t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s i s a c h i e v e d b y w r i t i n g t o t h e e n e r g y m e a s u r e m e n t p o i n t e r a d d r e s s s f r ( m a d d p t , 0 x 9 1 ) . t h i s s f r s e l e c t s t h e e n e r g y m e a s u r e m e n t r e g i s t e r t o b e a c c e s s e d a n d d e t e r m i n e s i f a r e a d o r a w r i t e i s p e r f o r m e d ( s e e t a b l e 2 8 ) . t a b l e 2 8 . e n e r g y m e a s u r e m e n t p o i n t e r a d d r e s s s f r ( m a d d p t , 0 x 9 1 ) b i t d e s c r i p t i o n 7 1 = w r i t e , 0 = r e a d 6 t o 0 e n e r g y m e a s u r e m e n t i n t e r n a l r e g i s t e r a d d r e s s w r i t i n g t o t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s w h e n b i t 7 o f t h e e n e r g y m e a s u r e m e n t p o i n t e r a d d r e s s s f r ( m a d d p t , 0 x 9 1 ) i s s e t , t h e c o n t e n t s o f t h e m d a t x s f r s ( m d a t l , m d a t m , a n d m d a t h ) a r e t r a n s f e r r e d t o t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r d e s i g n a t e d b y t h e a d d r e s s i n t h e m a d d p t s f r . i f t h e i n t e r n a l r e g i s t e r i s 1 b y t e l o n g , o n l y t h e m d a t l s f r c o n t e n t i s c o p i e d t o t h e i n t e r n a l r e g i s t e r , a n d t h e m d a t m s f r a n d m d a t h s f r c o n t e n t s a r e i g n o r e d . t h e e n e r g y m e a s u r e m e n t c o r e f u n c t i o n s w i t h a n i n t e r n a l c l o c k o f 4 . 0 9 6 m h z  5 , o r 8 1 9 . 2 k h z . b e c a u s e t h e 8 0 5 2 c o r e f u n c t i o n s w i t h a n o t h e r c l o c k , 4 . 0 9 6 m h z  2 c d , s y n c h r o n i z a t i o n b e t w e e n t h e t w o c l o c k e n v i r o n m e n t s w h e n c d = 0 o r 1 i s a n i s s u e . w h e n d a t a i s w r i t t e n t o t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s , a s m a l l w a i t p e r i o d n e e d s t o b e i m p l e m e n t e d b e f o r e a n o t h e r r e a d o r w r i t e t o t h e s e r e g i s t e r s c a n t a k e p l a c e . s a m p l e c o d e t o w r i t e 0 x 0 1 5 5 t o t h e 2 - b y t e s a g l v l r e g i s t e r l o c a t e d a t 0 x 1 4 i n t h e e n e r g y m e a s u r e m e n t m e m o r y s p a c e i s a s f o l l o w s : m o v m d a t m , # 0 1 h m o v m d a t l , # 5 5 h m o v m a d d p t , # s a g l v l _ w ( a d d r e s s 0 x 9 4 ) m o v a , # 0 5 h d j n z a c c , $ ; n e x t w r i t e o r r e a d t o e n e r g y m e a s u r e m e n t s f r c a n b e d o n e a f t e r t h i s . r e a d i n g t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s w h e n b i t 7 o f e n e r g y m e a s u r e m e n t p o i n t e r a d d r e s s s f r ( m a d d p t , 0 x 9 1 ) i s c l e a r e d , t h e c o n t e n t o f t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r d e s i g n a t e d b y t h e a d d r e s s i n m a d d p t i s t r a n s f e r r e d t o t h e m d a t x s f r s . i f t h e i n t e r n a l r e g i s t e r i s 1 b y t e l o n g , o n l y t h e m d a t l s f r c o n t e n t i s u p d a t e d w i t h a n e w v a l u e , w h e r e a s t h e m d a t m s f r a n d m d a t h s f r c o n t e n t s a r e r e s e t t o 0 x 0 0 . t h e e n e r g y m e a s u r e m e n t c o r e f u n c t i o n s w i t h a n i n t e r n a l c l o c k o f 4 . 0 9 6 m h z  5 , o r 8 1 9 . 2 k h z . b e c a u s e t h e 8 0 5 2 c o r e f u n c t i o n s w i t h a n o t h e r c l o c k , 4 . 0 9 6 m h z  2 c d , s y n c h r o n i z a t i o n b e t w e e n t h e t w o c l o c k e n v i r o n m e n t s w h e n c d = 0 o r 1 i s a n i s s u e . w h e n d a t a i s r e a d f r o m t h e i n t e r n a l e n e r g y m e a s u r e m e n t r e g i s t e r s , a s m a l l w a i t p e r i o d n e e d s t o b e i m p l e m e n t e d b e f o r e t h e m d a t x s f r s a r e t r a n s f e r r e d t o a n o t h e r s f r . s a m p l e c o d e t o r e a d t h e p e a k v o l t a g e i n t h e 2 - b y t e v p k l v l r e g i s t e r l o c a t e d a t 0 x 1 6 i n t o t h e d a t a p o i n t e r i s a s f o l l o w s : m o v m a d d p t , # v p k l v l _ r ( a d d r e s s 0 x 1 6 ) m o v a , # 0 5 h d j n z a c c , $ m o v d p h , m d a t m m o v d p l , m d a t l
a d e 7 5 1 8 r e v . 0 | p a g e 3 4 o f 1 2 8 t a b l e 2 9 . e n e r g y m e a s u r e m e n t s f r s a d d r e s s r / w m n e m o n i c d e s c r i p t i o n 0 x 9 1 r / w m a d d p t e n e r g y m e a s u r e m e n t p o i n t e r a d d r e s s . 0 x 9 2 r / w m d a t l e n e r g y m e a s u r e m e n t p o i n t e r d a t a l o w e s t s i g n i f i c a n t b y t e . 0 x 9 3 r / w m d a t m e n e r g y m e a s u r e m e n t p o i n t e r d a t a m i d d l e b y t e . 0 x 9 4 r / w m d a t h e n e r g y m e a s u r e m e n t p o i n t e r d a t a m o s t s i g n i f i c a n t b y t e . 0 x d 1 r v r m s l v r m s m e a s u r e m e n t l o w e s t s i g n i f i c a n t b y t e . 0 x d 2 r v r m s m v r m s m e a s u r e m e n t m i d d l e b y t e . 0 x d 3 r v r m s h v r m s m e a s u r e m e n t m o s t s i g n i f i c a n t b y t e . 0 x d 4 r i r m s l i r m s m e a s u r e m e n t l o w e s t s i g n i f i c a n t b y t e . 0 x d 5 r i r m s m i r m s m e a s u r e m e n t m i d d l e b y t e . 0 x d 6 r i r m s h i r m s m e a s u r e m e n t m o s t s i g n i f i c a n t b y t e . 0 x d 9 r / w m i r q e n l e n e r g y m e a s u r e m e n t i n t e r r u p t e n a b l e l o w e s t s i g n i f i c a n t b y t e . 0 x d a r / w m i r q e n m e n e r g y m e a s u r e m e n t i n t e r r u p t e n a b l e m i d d l e b y t e . 0 x d b r / w m i r q e n h e n e r g y m e a s u r e m e n t i n t e r r u p t e n a b l e m o s t s i g n i f i c a n t b y t e . 0 x d c r / w m i r q s t l e n e r g y m e a s u r e m e n t i n t e r r u p t s t a t u s l o w e s t s i g n i f i c a n t b y t e . 0 x d d r / w m i r q s t m e n e r g y m e a s u r e m e n t i n t e r r u p t s t a t u s m i d d l e b y t e . 0 x d e r / w m i r q s t h e n e r g y m e a s u r e m e n t i n t e r r u p t s t a t u s m o s t s i g n i f i c a n t b y t e . 0 x e 2 r w a v 1 l s e l e c t i o n 1 s a m p l e l o w e s t s i g n i f i c a n t b y t e . 0 x e 3 r w a v 1 m s e l e c t i o n 1 s a m p l e m i d d l e b y t e . 0 x e 4 r w a v 1 h s e l e c t i o n 1 s a m p l e m o s t s i g n i f i c a n t b y t e . 0 x e 5 r w a v 2 l s e l e c t i o n 2 s a m p l e l o w e s t s i g n i f i c a n t b y t e . 0 x e 6 r w a v 2 m s e l e c t i o n 2 s a m p l e m i d d l e b y t e . 0 x e 7 r w a v 2 h s e l e c t i o n 2 s a m p l e m o s t s i g n i f i c a n t b y t e . a d c d f c 2 m u l t i p l i e r w a t t o s [ 1 5 : 0 ] v a g a i n [ 1 1 : 0 ] v a d i v [ 7 : 0 ] i r m s o s [ 1 1 : 0 ] v r m s o s [ 1 1 : 0 ] w g a i n [ 1 1 : 0 ] m e t e r i n g s f r s p h c a l [ 7 : 0 ] v n v p p g a 2 c f 1 w d i v [ 7 : 0 ] % % n ? 2 2 1 , 2 , 4 , 8 , 1 6 a d c i p i n p g a 1 i { g a i n [ 2 : 0 ] } v a r d i v [ 7 : 0 ] % v a r o s [ 1 5 : 0 ] v a r g a i n [ 1 1 : 0 ] d f c c f 2 n u m [ 1 5 : 0 ] c f 2 d e n [ 1 5 : 0 ] c f 1 d e n [ 1 5 : 0 ] c f 1 n u m [ 1 5 : 0 ] c f 2 h p f h p f l p f l p f l p f 2 l p f 2 0 7 3 2 7 - 0 3 4 f i g u r e 3 4 . e n e r g y m e t e r i n g b l o c k d i a g r a m
a d e 7 5 1 8 r e v . 0 | p a g e 3 5 o f 1 2 8 e n e r g y m e a s u r e m e n t r e g i s t e r s t a b l e 3 0 . e n e r g y m e a s u r e m e n t r e g i s t e r l i s t a d d r e s s m a d d p t [ 6 : 0 ] m n e m o n i c r / w l e n g t h ( b i t s ) s i g n e d / u n s i g n e d d e f a u l t d e s c r i p t i o n 0 x 0 1 w a t t h r r 2 4 s 0 r e a d s w h a c c u m u l a t o r w i t h o u t r e s e t . 0 x 0 2 r w a t t h r r 2 4 s 0 r e a d s w h a c c u m u l a t o r w i t h r e s e t . 0 x 0 3 l w a t t h r r 2 4 s 0 r e a d s w h a c c u m u l a t o r s y n c h r o n o u s t o l i n e c y c l e . 0 x 0 4 v a r h r r 2 4 s 0 r e a d s v a r h a c c u m u l a t o r w i t h o u t r e s e t . 0 x 0 5 r v a r h r r 2 4 s 0 r e a d s v a r h a c c u m u l a t o r w i t h r e s e t . 0 x 0 6 l v a r h r r 2 4 s 0 r e a d s v a r h a c c u m u l a t o r s y n c h r o n o u s t o l i n e c y c l e . 0 x 0 7 v a h r r 2 4 s 0 r e a d s v a h a c c u m u l a t o r w i t h o u t r e s e t . i f t h e v a r m s c f c o n b i t i n m o d e 2 r e g i s t e r ( 0 x 0 c ) i s s e t , t h i s r e g i s t e r a c c u m u l a t e s i r m s . 0 x 0 8 r v a h r r 2 4 s 0 r e a d s v a h a c c u m u l a t o r w i t h r e s e t . i f t h e v a r m s c f c o n b i t i n m o d e 2 r e g i s t e r ( 0 x 0 c ) i s s e t , t h i s r e g i s t e r a c c u m u l a t e s i r m s . 0 x 0 9 l v a h r r 2 4 s 0 r e a d s v a h a c c u m u l a t o r s y n c h r o n o u s t o l i n e c y c l e . i f t h e v a r m s c f c o n b i t i n m o d e 2 r e g i s t e r ( 0 x 0 c ) i s s e t , t h i s r e g i s t e r a c c u m u l a t e s i r m s . 0 x 0 a p e r _ f r e q r 1 6 u 0 r e a d s l i n e p e r i o d o r f r e q u e n c y r e g i s t e r d e p e n d i n g o n m o d e 2 r e g i s t e r . 0 x 0 b m o d e 1 r / w 8 u 0 x 0 6 s e t s b a s i c c o n f i g u r a t i o n o f e n e r g y m e a s u r e m e n t ( s e e t a b l e 3 1 ) . 0 x 0 c m o d e 2 r / w 8 u 0 x 4 0 s e t s b a s i c c o n f i g u r a t i o n o f e n e r g y m e a s u r e m e n t ( s e e t a b l e 3 2 ) . 0 x 0 d w a v m o d e r / w 8 u 0 s e t s c o n f i g u r a t i o n o f w a v e f o r m s a m p l e 1 a n d w a v e f o r m s a m p l e 2 ( s e e t a b l e 3 3 ) . 0 x 0 e n l m o d e r / w 8 u 0 s e t s e n e r g y l e v e l o f n o l o a d t h r e s h o l d s ( s e e t a b l e 3 4 ) . 0 x 0 f a c c m o d e r / w 8 u 0 s e t s c o n f i g u r a t i o n o f w a t t , v a r a c c u m u l a t i o n , a n d v a r i o u s t a m p e r a l a r m s ( s e e t a b l e 3 5 ) . 0 x 1 0 p h c a l r / w 8 s 0 x 4 0 s e t s p h a s e c a l i b r a t i o n r e g i s t e r ( s e e t h e p h a s e c o m p e n s a t i o n s e c t i o n ) . 0 x 1 1 z x t o u t r / w 1 2 u 0 x 0 f f f s e t s t i m e o u t f o r z e r o - c r o s s i n g t i m e o u t d e t e c t i o n ( s e e t h e z e r o - c r o s s i n g t i m e o u t s e c t i o n ) . 0 x 1 2 l i n c y c r / w 1 6 u 0 x f f f f s e t s n u m b e r o f h a l f - l i n e c y c l e s f o r l w a t t h r , l v a r h r , a n d l v a h r a c c u m u l a t o r s . 0 x 1 3 s a g c y c r / w 8 u 0 x f f s e t s n u m b e r o f h a l f - l i n e c y c l e s f o r s a g d e t e c t i o n ( s e e t h e l i n e v o l t a g e s a g d e t e c t i o n s e c t i o n ) . 0 x 1 4 s a g l v l r / w 1 6 u 0 s e t s d e t e c t i o n l e v e l f o r s a g d e t e c t i o n ( s e e t h e l i n e v o l t a g e s a g d e t e c t i o n s e c t i o n ) . 0 x 1 5 i p k l v l r / w 1 6 u 0 x f f f f s e t s p e a k d e t e c t i o n l e v e l f o r c u r r e n t p e a k d e t e c t i o n ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 6 v p k l v l r / w 1 6 u 0 x f f f f s e t s p e a k d e t e c t i o n l e v e l f o r v o l t a g e p e a k d e t e c t i o n ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 7 i p e a k r 2 4 u 0 r e a d s c u r r e n t p e a k l e v e l w i t h o u t r e s e t ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 8 r s t i p e a k r 2 4 u 0 r e a d s c u r r e n t p e a k l e v e l w i t h r e s e t ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 9 v p e a k r 2 4 u 0 r e a d s v o l t a g e p e a k l e v e l w i t h o u t r e s e t ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 a r s t v p e a k r 2 4 u 0 r e a d s v o l t a g e p e a k l e v e l w i t h r e s e t ( s e e t h e p e a k d e t e c t i o n s e c t i o n ) . 0 x 1 b g a i n r / w 8 u 0 s e t s p g a g a i n o f a n a l o g i n p u t s ( s e e t a b l e 3 6 ) . 0 x 1 c r e s e r v e d r / w 1 2 s 0 r e s e r v e d . 0 x 1 d w g a i n r / w 1 2 s 0 s e t s w a t t g a i n r e g i s t e r . 0 x 1 e v a r g a i n r / w 1 2 s 0 s e t s v a r g a i n r e g i s t e r . 0 x 1 f v a g a i n r / w 1 2 s 0 s e t s v a g a i n r e g i s t e r . 0 x 2 0 w a t t o s r / w 1 6 s 0 s e t s w a t t o f f s e t r e g i s t e r . 0 x 2 1 v a r o s r / w 1 6 s 0 s e t s v a r o f f s e t r e g i s t e r . 0 x 2 2 i r m s o s r / w 1 2 s 0 s e t s c u r r e n t r m s o f f s e t r e g i s t e r . 0 x 2 3 v r m s o s r / w 1 2 s 0 s e t s v o l t a g e r m s o f f s e t r e g i s t e r . 0 x 2 4 w d i v r / w 8 u 0 s e t s w a t t e n e r g y s c a l i n g r e g i s t e r . 0 x 2 5 v a r d i v r / w 8 u 0 s e t s v a r e n e r g y s c a l i n g r e g i s t e r . 0 x 2 6 v a d i v r / w 8 u 0 s e t s v a e n e r g y s c a l i n g r e g i s t e r . 0 x 2 7 c f 1 n u m r / w 1 6 u 0 s e t s c f 1 n u m e r a t o r r e g i s t e r . 0 x 2 8 c f 1 d e n r / w 1 6 u 0 x 0 0 3 f s e t s c f 1 d e n o m i n a t o r r e g i s t e r .
a d e 7 5 1 8 r e v . 0 | p a g e 3 6 o f 1 2 8 a d d r e s s m a d d p t [ 6 : 0 ] m n e m o n i c r / w l e n g t h ( b i t s ) s i g n e d / u n s i g n e d d e f a u l t d e s c r i p t i o n 0 x 2 9 c f 2 n u m r / w 1 6 u 0 s e t s c f 2 n u m e r a t o r r e g i s t e r . 0 x 2 a c f 2 d e n r / w 1 6 u 0 x 0 0 3 f s e t s c f 2 d e n o m i n a t o r r e g i s t e r . 0 x 3 b r e s e r v e d 0 t h i s r e g i s t e r m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 0 x 3 c r e s e r v e d 0 x 0 3 0 0 t h i s r e g i s t e r m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 0 x 3 d r e s e r v e d 0 t h i s r e g i s t e r m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 0 x 3 e r e s e r v e d 0 t h i s r e g i s t e r m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 0 x 3 f r e s e r v e d 0 t h i s r e g i s t e r m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . e n e r g y m e a s u r e m e n t i n t e r n a l r e g i s t e r s d e t a i l s t a b l e 3 1 . m o d e 1 r e g i s t e r ( 0 x 0 b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 s w r s t 0 s e t t i n g t h i s b i t r e s e t s a l l o f t h e e n e r g y m e a s u r e m e n t r e g i s t e r s t o t h e i r d e f a u l t v a l u e s . 6 d i s z x l p f 0 s e t t i n g t h i s b i t d i s a b l e s t h e z e r o - c r o s s i n g l o w - p a s s f i l t e r . 5 r e s e r v e d 0 t h i s b i t m u s t b e k e p t a t i t s d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 4 s w a p b i t s 0 s e t t i n g t h i s b i t s w a p s c h 1 a d c a n d c h 2 a d c . 3 p w r d n 0 s e t t i n g t h i s b i t p o w e r s d o w n v o l t a g e a n d c u r r e n t a d c s . 2 d i s c f 2 1 s e t t i n g t h i s b i t d i s a b l e s f r e q u e n c y o u t p u t c f 2 . 1 d i s c f 1 1 s e t t i n g t h i s b i t d i s a b l e s f r e q u e n c y o u t p u t c f 1 . 0 d i s h p f 0 s e t t i n g t h i s b i t d i s a b l e s t h e h p f s i n v o l t a g e a n d c u r r e n t c h a n n e l s . t a b l e 3 2 . m o d e 2 r e g i s t e r ( 0 x 0 c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 c f 2 s e l [ 1 : 0 ] 0 1 c o n f i g u r a t i o n b i t s f o r c f 2 o u t p u t . c f 2 s e l [ 1 : 0 ] r e s u l t 0 0 c f 2 f r e q u e n c y i s p r o p o r t i o n a l t o a c t i v e p o w e r . 0 1 c f 2 f r e q u e n c y i s p r o p o r t i o n a l t o r e a c t i v e p o w e r . 1 x c f 2 f r e q u e n c y i s p r o p o r t i o n a l t o a p p a r e n t p o w e r o r i r m s . 5 t o 4 c f 1 s e l [ 1 : 0 ] 0 0 c o n f i g u r a t i o n b i t s f o r c f 1 o u t p u t . c f 1 s e l [ 1 : 0 ] r e s u l t 0 0 c f 1 f r e q u e n c y i s p r o p o r t i o n a l t o a c t i v e p o w e r . 0 1 c f 1 f r e q u e n c y i s p r o p o r t i o n a l t o r e a c t i v e p o w e r . 1 x c f 1 f r e q u e n c y i s p r o p o r t i o n a l t o a p p a r e n t p o w e r o r i r m s . 3 v a r m s c f c o n 0 c o n f i g u r a t i o n b i t s f o r a p p a r e n t p o w e r o r i r m s f o r c f 1 , c f 2 o u t p u t s , a n d v a a c c u m u l a t i o n r e g i s t e r s ( v a h r , r v a h r , a n d l v a h r ) . n o t e t h a t c f 1 c a n n o t b e p r o p o r t i o n a l t o v a i f c f 2 i s p r o p o r t i o n a l t o i r m s a n d v i c e v e r s a . v a r m s c f c o n r e s u l t 0 i f c f 1 s e l [ 1 : 0 ] = 1 x , c f 1 i s p r o p o r t i o n a l t o v a . i f c f 2 s e l [ 1 : 0 ] = 1 x , c f 2 i s p r o p o r t i o n a l t o v a . 1 i f c f 1 s e l [ 1 : 0 ] = 1 x , c f 1 i s p r o p o r t i o n a l t o i r m s . i f c f 2 s e l [ 1 : 0 ] = 1 x , c f 2 i s p r o p o r t i o n a l t o i r m s . 2 z x r m s 0 l o g i c 1 e n a b l e s u p d a t e o f r m s v a l u e s s y n c h r o n o u s l y t o v o l t a g e z x . 1 f r e q s e l c o n f i g u r a t i o n b i t s t o s e l e c t p e r i o d o r f r e q u e n c y m e a s u r e m e n t f o r p e r _ f r e q r e g i s t e r ( 0 x 0 a ) . f r e q s e l r e s u l t 0 p e r _ f r e q r e g i s t e r h o l d s a p e r i o d m e a s u r e m e n t . 1 p e r _ f r e q r e g i s t e r h o l d s a f r e q u e n c y m e a s u r e m e n t . 0 w a v e n 0 w h e n t h i s b i t i s s e t , t h e w a v e f o r m s a m p l i n g m o d e i s e n a b l e d .
a d e 7 5 1 8 r e v . 0 | p a g e 3 7 o f 1 2 8 t a b l e 3 3 . w a v m o d e r e g i s t e r ( 0 x 0 d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 5 w a v 2 s e l [ 2 : 0 ] 0 0 0 w a v e f o r m 2 s e l e c t i o n f o r s a m p l e s m o d e . w a v 2 s e l [ 2 : 0 ] s o u r c e 0 0 0 c u r r e n t 0 0 1 v o l t a g e 0 1 0 a c t i v e p o w e r m u l t i p l i e r o u t p u t 0 1 1 r e a c t i v e p o w e r m u l t i p l i e r o u t p u t 1 0 0 v a m u l t i p l i e r o u t p u t 1 0 1 i r m s l p f o u t p u t o t h e r s r e s e r v e d 4 t o 2 w a v 1 s e l [ 2 : 0 ] 0 0 0 w a v e f o r m 1 s e l e c t i o n f o r s a m p l e s m o d e . w a v 1 s e l [ 2 : 0 ] s o u r c e 0 0 0 c u r r e n t 0 0 1 v o l t a g e 0 1 0 a c t i v e p o w e r m u l t i p l i e r o u t p u t 0 1 1 r e a c t i v e p o w e r m u l t i p l i e r o u t p u t 1 0 0 v a m u l t i p l i e r o u t p u t 1 0 1 i r m s l p f o u t p u t ( l o w 2 4 - b i t ) o t h e r s r e s e r v e d 1 t o 0 d t r t [ 1 : 0 ] 0 0 w a v e f o r m s a m p l e s o u t p u t d a t a r a t e . d t r t [ 1 : 0 ] u p d a t e r a t e ( c l o c k = f c o r e / 5 = 8 1 9 . 2 k h z ) 0 0 2 5 . 6 k s p s ( c l o c k / 3 2 ) 0 1 1 2 . 8 k s p s ( c l o c k / 6 4 ) 1 0 6 . 4 k s p s ( c l o c k / 1 2 8 ) 1 1 3 . 2 k s p s ( c l o c k / 2 5 6 ) t a b l e 3 4 . n l m o d e r e g i s t e r ( 0 x 0 e ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 d i s v a r c m p 0 s e t t i n g t h i s b i t d i s a b l e s f u n d a m e n t a l v a r g a i n c o m p e n s a t i o n o v e r l i n e f r e q u e n c y . 6 i r m s n o l o a d 0 l o g i c 1 e n a b l e s i r m s n o l o a d t h r e s h o l d d e t e c t i o n . t h e l e v e l i s d e f i n e d b y t h e s e t t i n g o f t h e v a n o l o a d b i t s . 5 t o 4 v a n o l o a d [ 1 : 0 ] 0 0 a p p a r e n t p o w e r n o l o a d t h r e s h o l d . v a n o l o a d [ 1 : 0 ] r e s u l t 0 0 n o l o a d d e t e c t i o n d i s a b l e d 0 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 3 0 % o f f u l l s c a l e 1 0 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 1 5 % o f f u l l s c a l e 1 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 0 7 5 % o f f u l l s c a l e 3 t o 2 v a r n o l o a d [ 1 : 0 ] 0 0 r e a c t i v e p o w e r n o l o a d t h r e s h o l d . v a r n o l o a d [ 1 : 0 ] r e s u l t 0 0 n o l o a d d e t e c t i o n d i s a b l e d 0 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 1 5 % o f f u l l s c a l e 1 0 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 0 7 5 % o f f u l l s c a l e 1 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 0 3 7 % o f f u l l s c a l e 1 t o 0 a p n o l o a d [ 1 : 0 ] 0 0 a c t i v e p o w e r n o l o a d t h r e s h o l d . a p n o l o a d [ 1 : 0 ] r e s u l t 0 0 n o l o a d d e t e c t i o n d i s a b l e d 0 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 1 5 % o f f u l l s c a l e 1 0 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 0 7 5 % o f f u l l s c a l e 1 1 n o l o a d d e t e c t i o n e n a b l e d w i t h t h r e s h o l d = 0 . 0 0 3 7 % o f f u l l s c a l e
a d e 7 5 1 8 r e v . 0 | p a g e 3 8 o f 1 2 8 t a b l e 3 5 . a c c m o d e r e g i s t e r ( 0 x 0 f ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 r e s e r v e d 0 t h e s e b i t s s h o u l d b e l e f t a t t h e i r d e f a u l t v a l u e f o r p r o p e r o p e r a t i o n . 5 v a r s i g n 0 c o n f i g u r a t i o n b i t t o s e l e c t t h e e v e n t t h a t t r i g g e r s a r e a c t i v e p o w e r s i g n i n t e r r u p t . i f s e t t o 0 , v a r s i g n i n t e r r u p t o c c u r s w h e n r e a c t i v e p o w e r c h a n g e s f r o m p o s i t i v e t o n e g a t i v e . i f t h i s b i t i s s e t t o 1 , v a r s i g n i n t e r r u p t o c c u r s w h e n r e a c t i v e p o w e r c h a n g e s f r o m n e g a t i v e t o p o s i t i v e . 4 a p s i g n 0 c o n f i g u r a t i o n b i t t o s e l e c t e v e n t t h a t t r i g g e r s a n a c t i v e p o w e r s i g n i n t e r r u p t . i f s e t t o 0 , a p s i g n i n t e r r u p t o c c u r s w h e n a c t i v e p o w e r c h a n g e s f r o m p o s i t i v e t o n e g a t i v e . i f t h i s b i t i s s e t t o 1 , a p s i g n i n t e r r u p t o c c u r s w h e n a c t i v e p o w e r c h a n g e s f r o m n e g a t i v e t o p o s i t i v e . 3 a b s v a r m 0 l o g i c 1 e n a b l e s a b s o l u t e v a l u e a c c u m u l a t i o n o f r e a c t i v e p o w e r i n e n e r g y r e g i s t e r a n d p u l s e o u t p u t . 2 s a v a r m 0 l o g i c 1 e n a b l e s r e a c t i v e p o w e r a c c u m u l a t i o n d e p e n d i n g o n t h e s i g n o f t h e a c t i v e p o w e r . i f a c t i v e p o w e r i s p o s i t i v e , v a r i s a c c u m u l a t e d a s i t i s . i f a c t i v e p o w e r i s n e g a t i v e , t h e s i g n o f t h e v a r i s r e v e r s e d f o r t h e a c c u m u l a t i o n . t h i s a c c u m u l a t i o n m o d e a f f e c t s b o t h t h e v a r r e g i s t e r s ( v a r h r , r v a r h r , l v a r h r ) a n d t h e p u l s e o u t p u t w h e n c o n n e c t e d t o v a r . 1 p o a m 0 l o g i c 1 e n a b l e s p o s i t i v e - o n l y a c c u m u l a t i o n o f a c t i v e p o w e r i n t h e w a t t h r e n e r g y r e g i s t e r a n d p u l s e o u t p u t . 0 a b s a m 0 l o g i c 1 e n a b l e s a b s o l u t e v a l u e a c c u m u l a t i o n o f a c t i v e p o w e r i n t h e w a t t h r e n e r g y r e g i s t e r a n d p u l s e o u t p u t . t a b l e 3 6 . g a i n r e g i s t e r ( 0 x 1 b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 5 p g a 2 [ 2 : 0 ] 0 0 0 t h e s e b i t s d e f i n e t h e v o l t a g e c h a n n e l i n p u t g a i n . p g a 2 [ 2 : 0 ] r e s u l t 0 0 0 g a i n = 1 0 0 1 g a i n = 2 0 1 0 g a i n = 4 0 1 1 g a i n = 8 1 0 0 g a i n = 1 6 4 r e s e r v e d 0 r e s e r v e d . 3 c f s i g n _ o p t 0 t h i s b i t d e f i n e s w h e r e t h e c f c h a n g e o f s i g n d e t e c t i o n ( a p s i g n o r v a r s i g n ) i s i m p l e m e n t e d . c f s i g n _ o p t r e s u l t 0 f i l t e r e d p o w e r s i g n a l 1 o n a p e r c f p u l s e b a s i s 2 t o 0 p g a 1 [ 2 : 0 ] 0 0 0 t h e s e b i t s d e f i n e t h e c u r r e n t c h a n n e l i n p u t g a i n . p g a 1 [ 2 : 0 ] r e s u l t 0 0 0 g a i n = 1 0 0 1 g a i n = 2 0 1 0 g a i n = 4 0 1 1 g a i n = 8 1 0 0 g a i n = 1 6 i n t e r r u p t s t a t u s / e n a b l e s f r s t a b l e 3 7 . i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) b i t i n t e r r u p t f l a g d e s c r i p t i o n 7 a d e i r q f l a g t h i s b i t i s s e t i f a n y o f t h e a d e s t a t u s f l a g s t h a t a r e e n a b l e d t o g e n e r a t e a n a d e i n t e r r u p t a r e s e t . t h i s b i t i s a u t o m a t i c a l l y c l e a r e d w h e n a l l o f t h e e n a b l e d a d e s t a t u s f l a g s a r e c l e a r e d . 6 r e s e r v e d r e s e r v e d . 5 r e s e r v e d r e s e r v e d . 4 v a r s i g n l o g i c 1 i n d i c a t e s t h a t t h e r e a c t i v e p o w e r s i g n h a s c h a n g e d a c c o r d i n g t o t h e c o n f i g u r a t i o n o f t h e a c c m o d e r e g i s t e r . 3 a p s i g n l o g i c 1 i n d i c a t e s t h a t t h e a c t i v e p o w e r s i g n h a s c h a n g e d a c c o r d i n g t o t h e c o n f i g u r a t i o n o f t h e a c c m o d e r e g i s t e r . 2 v a n o l o a d l o g i c 1 i n d i c a t e s t h a t a n i n t e r r u p t h a s b e e n c a u s e d b y a n a p p a r e n t p o w e r n o l o a d d e t e c t i o n . t h i s i n t e r r u p t i s a l s o u s e d t o r e f l e c t t h e p a r t e n t e r i n g t h e i r m s n o l o a d m o d e . 1 r n o l o a d l o g i c 1 i n d i c a t e s t h a t a n i n t e r r u p t h a s b e e n c a u s e d b y a r e a c t i v e p o w e r n o l o a d d e t e c t i o n . 0 a p n o l o a d l o g i c 1 i n d i c a t e s t h a t a n i n t e r r u p t h a s b e e n c a u s e d b y a n a c t i v e p o w e r n o l o a d d e t e c t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 3 9 o f 1 2 8 t a b l e 3 8 . i n t e r r u p t s t a t u s 2 s f r ( m i r q s t m , 0 x d d ) b i t i n t e r r u p t f l a g d e s c r i p t i o n 7 c f 2 l o g i c 1 i n d i c a t e s t h a t a p u l s e o n c f 2 h a s b e e n i s s u e d . t h e f l a g i s s e t e v e n i f t h e c f 2 p u l s e o u t p u t i s n o t e n a b l e d b y c l e a r i n g b i t 2 o f t h e m o d e 1 r e g i s t e r . 6 c f 1 l o g i c 1 i n d i c a t e s t h a t a p u l s e o n c f 1 h a s b e e n i s s u e d . t h e f l a g i s s e t e v e n i f t h e c f 1 p u l s e o u t p u t i s n o t e n a b l e d b y c l e a r i n g b i t 1 o f t h e m o d e 1 r e g i s t e r . 5 v a e o f l o g i c 1 i n d i c a t e s t h a t t h e v a h r r e g i s t e r h a s o v e r f l o w e d . 4 r e o f l o g i c 1 i n d i c a t e s t h a t t h e v a r h r r e g i s t e r h a s o v e r f l o w e d . 3 a e o f l o g i c 1 i n d i c a t e s t h a t t h e w a t t h r r e g i s t e r h a s o v e r f l o w e d . 2 v a e h f l o g i c 1 i n d i c a t e s t h a t t h e v a h r r e g i s t e r i s h a l f f u l l . 1 r e h f l o g i c 1 i n d i c a t e s t h a t t h e v a r h r r e g i s t e r i s h a l f f u l l . 0 a e h f l o g i c 1 i n d i c a t e s t h a t t h e w a t t h r r e g i s t e r i s h a l f f u l l . t a b l e 3 9 . i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) b i t i n t e r r u p t f l a g d e s c r i p t i o n 7 r e s e t i n d i c a t e s t h e e n d o f a r e s e t ( f o r b o t h s o f t w a r e a n d h a r d w a r e r e s e t ) . 6 r e s e r v e d r e s e r v e d . 5 w f s m l o g i c 1 i n d i c a t e s t h a t n e w d a t a i s p r e s e n t i n t h e w a v e f o r m r e g i s t e r s ( a d d r e s s 0 x e 2 t o a d d r e s s 0 x e 7 ) . 4 p k i l o g i c 1 i n d i c a t e s t h a t t h e c u r r e n t c h a n n e l h a s e x c e e d e d t h e i p k l v l v a l u e 3 p k v l o g i c 1 i n d i c a t e s t h a t t h e v o l t a g e c h a n n e l h a s e x c e e d e d t h e v p k l v l v a l u e . 2 c y c e n d l o g i c 1 i n d i c a t e s t h e e n d o f t h e e n e r g y a c c u m u l a t i o n o v e r a n i n t e g e r n u m b e r o f h a l f - l i n e c y c l e s . 1 z x t o l o g i c 1 i n d i c a t e s t h a t n o z e r o c r o s s i n g o n t h e l i n e v o l t a g e h a p p e n e d f o r t h e l a s t z x t o u t h a l f - l i n e c y c l e s . 0 z x l o g i c 1 i n d i c a t e s d e t e c t i o n o f a z e r o c r o s s i n g i n t h e v o l t a g e c h a n n e l . t a b l e 4 0 . i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) b i t i n t e r r u p t e n a b l e b i t d e s c r i p t i o n 7 t o 5 r e s e r v e d r e s e r v e d . 4 v a r s i g n w h e n t h i s b i t i s s e t , t h e v a r s i g n f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 3 a p s i g n w h e n t h i s b i t i s s e t , t h e a p s i g n f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 2 v a n o l o a d w h e n t h i s b i t i s s e t , t h e v a n o l o a d f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 1 r n o l o a d w h e n t h i s b i t i s s e t , t h e r n o l o a d f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 0 a p n o l o a d w h e n t h i s b i t i s s e t , t h e a p n o l o a d f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . t a b l e 4 1 . i n t e r r u p t e n a b l e 2 s f r ( m i r q e n m , 0 x d a ) b i t i n t e r r u p t e n a b l e b i t d e s c r i p t i o n 7 c f 2 w h e n t h i s b i t i s s e t , a c f 2 p u l s e c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 6 c f 1 w h e n t h i s b i t i s s e t , a c f 1 p u l s e c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 5 v a e o f w h e n t h i s b i t i s s e t , t h e v a e o f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 4 r e o f w h e n t h i s b i t i s s e t , t h e r e o f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 3 a e o f w h e n t h i s b i t i s s e t , t h e a e o f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 2 v a e h f w h e n t h i s b i t i s s e t , t h e v a e h f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 1 r e h f w h e n t h i s b i t i s s e t , t h e r e h f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 0 a e h f w h e n t h i s b i t i s s e t , t h e a e h f f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . t a b l e 4 2 . i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) b i t i n t e r r u p t e n a b l e b i t d e s c r i p t i o n 7 t o 6 r e s e r v e d r e s e r v e d . 5 w f s m w h e n t h i s b i t i s s e t , t h e w f s m f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 4 p k i w h e n t h i s b i t i s s e t , t h e p k i f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 3 p k v w h e n t h i s b i t i s s e t , t h e p k v f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 2 c y c e n d w h e n t h i s b i t i s s e t , t h e c y c e n d f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 1 z x t o w h e n t h i s b i t i s s e t , t h e z x t o f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e . 0 z x w h e n t h i s b i t i s s e t , t h e z x f l a g s e t c r e a t e s a p e n d i n g a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e .
a d e 7 5 1 8 r e v . 0 | p a g e 4 0 o f 1 2 8 a n a l o g i n p u t s t h e a d e 7 5 1 8 h a s t w o f u l l y d i f f e r e n t i a l v o l t a g e i n p u t c h a n n e l s . t h e m a x i m u m d i f f e r e n t i a l i n p u t v o l t a g e f o r i n p u t p a i r s v p / v n a n d i p / i n i s 0 . 4 v . e a c h a n a l o g i n p u t c h a n n e l h a s a p r o g r a m m a b l e g a i n a m p l i f i e r ( p g a ) w i t h p o s s i b l e g a i n s e l e c t i o n s o f 1 , 2 , 4 , 8 , a n d 1 6 . t h e g a i n s e l e c t i o n s a r e m a d e b y w r i t i n g t o t h e g a i n r e g i s t e r ( s e e t a b l e 3 6 a n d f i g u r e 3 6 ) . b i t 0 t o b i t 2 s e l e c t t h e g a i n f o r t h e p g a i n t h e c u r r e n t c h a n n e l , a n d b i t 5 t o b i t 7 s e l e c t t h e g a i n f o r t h e p g a i n t h e v o l t a g e c h a n n e l . f i g u r e 3 5 s h o w s h o w a g a i n s e l e c t i o n f o r t h e c u r r e n t c h a n n e l i s m a d e u s i n g t h e g a i n r e g i s t e r . k v i n v p v n 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 g a i n [ 7 : 0 ] g a i n ( k ) s e l e c t i o n v i n 0 7 3 2 7 - 0 3 5 f i g u r e 3 5 . p g a i n c u r r e n t c h a n n e l 0 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 g a i n r e g i s t e r * c u r r e n t a n d v o l t a g e c h a n n e l s p g a c o n t r o l p g a 2 g a i n s e l e c t 0 0 0 = 1 0 0 1 = 2 0 1 0 = 4 0 1 1 = 8 1 0 0 = 1 6 p g a 1 g a i n s e l e c t 0 0 0 = 1 0 0 1 = 2 0 1 0 = 4 0 1 1 = 8 1 0 0 = 1 6 r e s e r v e d * r e g i s t e r c o n t e n t s s h o w p o w e r - o n d e f a u l t s . a d d r : 0 x 1 b c f s i g n _ o p t 0 7 3 2 7 - 0 3 6 f i g u r e 3 6 . a n a l o g g a i n r e g i s t e r
a d e 7 5 1 8 r e v . 0 | p a g e 4 1 o f 1 2 8 a n a l o g - t o - d i g i t a l c o n v e r s i o n e a c h a d e 7 5 1 8 h a s t w o  -  a n a l o g - t o - d i g i t a l c o n v e r t e r s ( a d c s ) . t h e o u t p u t s o f t h e s e a d c s a r e m a p p e d d i r e c t l y t o w a v e f o r m s a m p l i n g s f r s ( a d d r e s s 0 x e 2 t o a d d r e s s 0 x e 7 ) a n d a r e u s e d f o r e n e r g y m e a s u r e m e n t i n t e r n a l d i g i t a l s i g n a l p r o c e s s i n g . i n p s m 1 ( b a t t e r y m o d e ) a n d p s m 2 ( s l e e p m o d e ) , t h e a d c s a r e p o w e r e d d o w n t o m i n i m i z e p o w e r c o n s u m p t i o n . f o r s i m p l i c i t y , t h e b l o c k d i a g r a m i n f i g u r e 3 8 s h o w s a f i r s t - o r d e r 6 -  a d c . t h e c o n v e r t e r i s m a d e u p o f t h e 6 -  m o d u l a t o r a n d t h e d i g i t a l l o w - p a s s f i l t e r . a 6 -  m o d u l a t o r c o n v e r t s t h e i n p u t s i g n a l i n t o a c o n t i n u o u s s e r i a l s t r e a m o f 1 s a n d 0 s a t a r a t e d e t e r m i n e d b y t h e s a m p l i n g c l o c k . i n t h e a d e 7 5 1 8 , t h e s a m p l i n g c l o c k i s e q u a l t o 4 . 0 9 6 m h z / 5 . t h e 1 - b i t d a c i n t h e f e e d b a c k l o o p i s d r i v e n b y t h e s e r i a l d a t a s t r e a m . t h e d a c o u t p u t i s s u b t r a c t e d f r o m t h e i n p u t s i g n a l . i f t h e l o o p g a i n i s h i g h e n o u g h , t h e a v e r a g e v a l u e o f t h e d a c o u t p u t ( a n d , t h e r e f o r e , t h e b i t s t r e a m ) c a n a p p r o a c h t h a t o f t h e i n p u t s i g n a l l e v e l . f o r a n y g i v e n i n p u t v a l u e i n a s i n g l e s a m p l i n g i n t e r v a l , t h e d a t a f r o m t h e 1 - b i t a d c i s v i r t u a l l y m e a n i n g l e s s . a m e a n i n g f u l r e s u l t i s o b t a i n e d o n l y w h e n a l a r g e n u m b e r o f s a m p l e s i s a v e r a g e d . t h i s a v e r a g i n g i s c a r r i e d i n t o t h e s e c o n d p a r t o f t h e a d c , t h e d i g i t a l l o w - p a s s f i l t e r . b y a v e r a g i n g a l a r g e n u m b e r o f b i t s f r o m t h e m o d u l a t o r , t h e l o w - p a s s f i l t e r c a n p r o d u c e 2 4 - b i t d a t a - w o r d s t h a t a r e p r o p o r t i o n a l t o t h e i n p u t s i g n a l l e v e l . t h e 6 -  c o n v e r t e r u s e s t w o t e c h n i q u e s t o a c h i e v e h i g h r e s o l u t i o n f r o m w h a t i s e s s e n t i a l l y a 1 - b i t c o n v e r s i o n t e c h n i q u e . t h e f i r s t i s o v e r s a m p l i n g . o v e r s a m p l i n g m e a n s t h a t t h e s i g n a l i s s a m p l e d a t a r a t e ( f r e q u e n c y ) t h a t i s m a n y t i m e s h i g h e r t h a n t h e b a n d w i d t h o f i n t e r e s t . f o r e x a m p l e , t h e s a m p l i n g r a t e i n t h e a d e 7 5 1 8 i s 4 . 0 9 6 m h z / 5 , o r 8 1 9 . 2 k h z , a n d t h e b a n d o f i n t e r e s t i s 4 0 h z t o 2 k h z . o v e r s a m p l i n g h a s t h e e f f e c t o f s p r e a d i n g t h e q u a n t i z a t i o n n o i s e ( n o i s e d u e t o s a m p l i n g ) o v e r a w i d e r b a n d w i d t h . w i t h t h e n o i s e s p r e a d m o r e t h i n l y o v e r a w i d e r b a n d w i d t h , t h e q u a n t i z a t i o n n o i s e i n t h e b a n d o f i n t e r e s t i s l o w e r e d ( s e e f i g u r e 3 7 ) . h o w e v e r , o v e r s a m p l i n g a l o n e i s n o t e f f i c i e n t e n o u g h t o i m p r o v e t h e s i g n a l - t o - n o i s e r a t i o ( s n r ) i n t h e b a n d o f i n t e r e s t . f o r e x a m p l e , a n o v e r s a m p l i n g r a t i o o f f o u r i s r e q u i r e d t o i n c r e a s e t h e s n r b y o n l y 6 d b ( 1 b i t ) . t o k e e p t h e o v e r s a m p l i n g r a t i o a t a r e a s o n a b l e l e v e l , i t i s p o s s i b l e t o s h a p e t h e q u a n t i z a t i o n n o i s e s o t h a t t h e m a j o r i t y o f t h e n o i s e l i e s a t t h e h i g h e r f r e q u e n c i e s . i n t h e 6 -  m o d u l a t o r , t h e n o i s e i s s h a p e d b y t h e i n t e g r a t o r , w h i c h h a s a h i g h - p a s s - t y p e r e s p o n s e f o r t h e q u a n t i z a t i o n n o i s e . t h e r e s u l t i s t h a t m o s t o f t h e n o i s e i s a t t h e h i g h e r f r e q u e n c i e s , w h e r e i t c a n b e r e m o v e d b y t h e d i g i t a l l o w - p a s s f i l t e r . t h i s n o i s e s h a p i n g i s s h o w n i n f i g u r e 3 7 . 4 0 9 . 6 0 8 1 9 . 2 2 n o i s e s i g n a l d i g i t a l f i l t e r a n t i a l i a s f i l t e r ( r c ) s a m p l i n g f r e q u e n c y h i g h r e s o l u t i o n o u t p u t f r o m d i g i t a l l p f s h a p e d n o i s e 4 0 9 . 6 0 8 1 9 . 2 2 n o i s e s i g n a l f r e q u e n c y ( k h z ) f r e q u e n c y ( k h z ) 0 7 3 2 7 - 0 3 7 f i g u r e 3 7 . n o i s e r e d u c t i o n d u e t o o v e r s a m p l i n g a n d n o i s e s h a p i n g i n t h e a n a l o g m o d u l a t o r + ? i n t e g r a t o r v r e f 1 - b i t d a c d i g i t a l l o w - p a s s f i l t e r 2 4 m c l k / 5 c r a n a l o g l o w - p a s s f i l t e r . . . 1 0 1 0 0 1 0 1 . . . l a t c h e d c o m p a r a t o r 0 7 3 2 7 - 0 3 8 f i g u r e 3 8 . f i r s t - o r d e r 6 -  a d c
a d e 7 5 1 8 r e v . 0 | p a g e 4 2 o f 1 2 8 a n t i a l i a s i n g f i l t e r f i g u r e 3 8 a l s o s h o w s a n a n a l o g l o w - p a s s f i l t e r ( r c ) o n t h e i n p u t t o t h e m o d u l a t o r . t h i s f i l t e r i s p r e s e n t t o p r e v e n t a l i a s i n g , a n a r t i f a c t o f a l l s a m p l e d s y s t e m s . a l i a s i n g m e a n s t h a t f r e q u e n c y c o m p o n e n t s i n t h e i n p u t s i g n a l t o t h e a d c , w h i c h a r e h i g h e r t h a n h a l f t h e s a m p l i n g r a t e o f t h e a d c , a p p e a r i n t h e s a m p l e d s i g n a l a t a f r e q u e n c y b e l o w h a l f t h e s a m p l i n g r a t e . f i g u r e 3 9 i l l u s t r a t e s t h e e f f e c t . f r e q u e n c y c o m p o n e n t s ( t h e b l a c k a r r o w s ) a b o v e h a l f t h e s a m p l i n g f r e q u e n c y ( a l s o k n o w n a s t h e n y q u i s t f r e q u e n c y , t h a t i s , 4 0 9 . 6 k h z ) a r e i m a g e d o r f o l d e d b a c k d o w n b e l o w 4 0 9 . 6 k h z . t h i s h a p p e n s w i t h a l l a d c s r e g a r d l e s s o f t h e a r c h i t e c t u r e . i n t h e e x a m p l e s h o w n i n f i g u r e 3 9 , o n l y f r e q u e n c i e s n e a r t h e s a m p l i n g f r e q u e n c y ( 8 1 9 . 2 k h z ) m o v e i n t o t h e b a n d o f i n t e r e s t f o r m e t e r i n g ( 4 0 h z t o 2 k h z ) . t h i s a l l o w s t h e u s e o f a v e r y s i m p l e l o w - p a s s f i l t e r ( l p f ) t o a t t e n u a t e h i g h f r e q u e n c y ( n e a r 8 1 9 . 2 k h z ) n o i s e a n d p r e v e n t s d i s t o r t i o n i n t h e b a n d o f i n t e r e s t . f o r c o n v e n t i o n a l c u r r e n t s e n s o r s , a s i m p l e r c f i l t e r ( s i n g l e - p o l e l p f ) w i t h a c o r n e r f r e q u e n c y o f 1 0 k h z p r o d u c e s a n a t t e n u a t i o n o f a p p r o x i m a t e l y 4 0 d b a t 8 1 9 . 2 k h z ( s e e f i g u r e 3 9 ) . t h e 2 0 d b p e r d e c a d e a t t e n u a t i o n i s u s u a l l y s u f f i c i e n t t o e l i m i n a t e t h e e f f e c t s o f a l i a s i n g f o r c o n v e n t i o n a l c u r r e n t s e n s o r s . h o w e v e r , f o r a d i / d t s e n s o r s u c h a s a r o g o w s k i c o i l , t h e s e n s o r h a s a 2 0 d b p e r d e c a d e g a i n . t h i s n e u t r a l i z e s t h e ? 2 0 d b p e r d e c a d e a t t e n u a - t i o n p r o d u c e d b y o n e s i m p l e l p f . t h e r e f o r e , w h e n u s i n g a d i / d t s e n s o r , c a r e s h o u l d b e t a k e n t o o f f s e t t h e 2 0 d b p e r d e c a d e g a i n . o n e s i m p l e a p p r o a c h i s t o c a s c a d e t w o r c f i l t e r s t o p r o d u c e t h e ? 4 0 d b p e r d e c a d e a t t e n u a t i o n n e e d e d . 4 0 9 . 6 0 8 1 9 . 2 2 f r e q u e n c y ( k h z ) s a m p l i n g f r e q u e n c y a l i a s i n g e f f e c t s i m a g e f r e q u e n c i e s 0 7 3 2 7 - 0 3 9 f i g u r e 3 9 . a d c a n d s i g n a l p r o c e s s i n g i n c u r r e n t c h a n n e l o u t l i n e d i m e n s i o n s a d c t r a n s f e r f u n c t i o n b o t h a d c s i n t h e a d e 7 5 1 8 a r e d e s i g n e d t o p r o d u c e t h e s a m e o u t p u t c o d e f o r t h e s a m e i n p u t s i g n a l l e v e l . w i t h a f u l l - s c a l e s i g n a l o n t h e i n p u t o f 0 . 4 v a n d a n i n t e r n a l r e f e r e n c e o f 1 . 2 v , t h e a d c o u t p u t c o d e i s n o m i n a l l y 2 , 1 4 7 , 4 8 3 , o r 0 x 2 0 c 4 9 b . t h e m a x i m u m c o d e f r o m t h e a d c i s 4 , 1 9 4 , 3 0 4 ; t h i s i s e q u i v a l e n t t o a n i n p u t s i g n a l l e v e l o f 0 . 7 9 4 v . h o w e v e r , f o r s p e c i f i e d p e r f o r - m a n c e , i t i s r e c o m m e n d e d t h a t t h e f u l l - s c a l e i n p u t s i g n a l l e v e l o f 0 . 4 v n o t b e e x c e e d e d . c u r r e n t c h a n n e l a d c f i g u r e 4 0 s h o w s t h e a d c a n d s i g n a l p r o c e s s i n g c h a i n f o r t h e c u r r e n t c h a n n e l . i n w a v e f o r m s a m p l i n g m o d e , t h e a d c o u t p u t s a s i g n e d , t w o s c o m p l e m e n t , 2 4 - b i t d a t a - w o r d a t a m a x i m u m o f 2 5 . 6 k s p s ( 4 . 0 9 6 m h z / 1 6 0 ) . w i t h t h e s p e c i f i e d f u l l - s c a l e a n a l o g i n p u t s i g n a l o f 0 . 4 v a n d p g a 1 = 1 , t h e a d c p r o d u c e s a n o u t p u t c o d e t h a t i s a p p r o x i m a t e l y b e t w e e n 0 x 2 0 c 4 9 b ( + 2 , 1 4 7 , 4 8 3 d ) a n d 0 x d f 3 b 6 5 ( ? 2 , 1 4 7 , 4 8 3 d ) . f o r i n p u t s o f 0 . 2 5 v , 0 . 1 2 5 v , 8 2 . 6 m v , a n d 3 1 . 3 m v w i t h p g a 1 = 2 , 4 , 8 , a n d 1 6 , r e s p e c t i v e l y , t h e a d c p r o d u c e s a n o u t p u t c o d e t h a t i s a p p r o x i m a t e l y b e t w e e n 0 x 2 8 f 5 c 2 ( + 2 , 6 8 4 , 3 5 4 d ) a n d 0 x d 7 0 a 3 e ( ? 2 , 6 8 4 , 3 5 4 d ) . p g a 1 a d c i p i n i r e f e r e n c e 1 , 2 , 4 8 , 1 6 { g a i n [ 2 : 0 ] } h p f c u r r e n t r m s ( i r m s ) c a l c u l a t i o n w a v e f o r m s a m p l e r e g i s t e r a c t i v e a n d r e a c t i v e p o w e r c a l c u l a t i o n 0 v v 1 a n a l o g i n p u t r a n g e 0 . 2 5 v , 0 . 1 2 5 v , 6 2 . 5 m v , 3 1 . 3 m v c u r r e n t c h a n n e l w a v e f o r m d a t a r a n g e 0 x 2 8 f 5 c 2 0 x 0 0 0 0 0 0 0 x d 7 0 a 3 e 0 7 3 2 7 - 0 4 0 f i g u r e 4 0 . a d c a n d s i g n a l p r o c e s s i n g i n c u r r e n t c h a n n e l w i t h p g a 1 = 1 , 2 , 4 , 8 , o r 1 6
a d e 7 5 1 8 r e v . 0 | p a g e 4 3 o f 1 2 8 v o l t a g e c h a n n e l a d c f i g u r e 4 1 s h o w s t h e a d c a n d s i g n a l p r o c e s s i n g c h a i n f o r t h e v o l t a g e c h a n n e l . i n w a v e f o r m s a m p l i n g m o d e , t h e a d c o u t p u t s a s i g n e d , t w o s c o m p l e m e n t , 2 4 - b i t d a t a - w o r d a t a m a x i m u m o f 2 5 . 6 k s p s ( m c l k / 1 6 0 ) . t h e a d c p r o d u c e s a n o u t p u t c o d e t h a t i s a p p r o x i m a t e l y b e t w e e n 0 x 2 8 f 5 ( + 1 0 , 4 8 5 d ) a n d 0 x d 7 0 b ( ? 1 0 , 4 8 5 d ) . c h a n n e l s a m p l i n g t h e w a v e f o r m s a m p l e s o f t h e c u r r e n t a d c a n d v o l t a g e a d c c a n a l s o b e r o u t e d t o t h e w a v e f o r m r e g i s t e r s t o b e r e a d b y t h e m c u c o r e . t h e a c t i v e , r e a c t i v e , a p p a r e n t p o w e r , a n d e n e r g y c a l c u l a t i o n r e m a i n u n i n t e r r u p t e d d u r i n g w a v e f o r m s a m p l i n g . w h e n i n w a v e f o r m s a m p l i n g m o d e , o n e o f f o u r o u t p u t s a m p l e r a t e s c a n b e c h o s e n b y u s i n g t h e d t r t [ 1 : 0 ] b i t s o f t h e w a v m o d e r e g i s t e r ( s e e t a b l e 3 3 ) . t h e o u t p u t s a m p l e r a t e c a n b e 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s . i f t h e w f s m e n a b l e b i t i s s e t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e s a m p l e d s i g n a l s s e l e c t e d i n t h e w a v m o d e r e g i s t e r a r e l a t c h e d i n t o t h e w a v e f o r m s f r s w h e n t h e w a v e f o r m h i g h b y t e ( w a v 1 h o r w a v 2 h ) i s r e a d . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e w f s m s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . a n a l o g i n p u t r a n g e h p f a d c r e f e r e n c e v 2 0 v 0 . 5 v , 0 . 2 5 v , 0 . 1 2 5 v , 6 2 . 5 m v , 3 1 . 3 m v v o l t a g e r m s ( v r m s ) c a l c u l a t i o n v p v n p g a 2 v 2 v o l t a g e c h a n n e l w a v e f o r m d a t a r a n g e 0 x d 7 0 b 0 x 0 0 0 0 0 x 2 8 f 5 a c t i v e a n d r e a c t i v e p o w e r c a l c u l a t i o n l p f 1 f ? 3 d b = 6 3 . 7 h z m o d e 1 [ 6 ] z x s i g n a l d a t a r a n g e f o r 6 0 h z s i g n a l 0 x e 2 3 0 0 x 0 0 0 0 0 x 1 d d 0 z x d e t e c t i o n z x s i g n a l d a t a r a n g e f o r 5 0 h z s i g n a l 0 x d f c 9 0 x 0 0 0 0 0 x 2 0 3 7 v o l t a g e p e a k d e t e c t 1 , 2 , 4 , 8 , 1 6 { g a i n [ 7 : 5 ] } w a v e f o r m s a m p l e r e g i s t e r 0 7 3 2 7 - 0 4 1 f i g u r e 4 1 . a d c a n d s i g n a l p r o c e s s i n g i n v o l t a g e c h a n n e l
a d e 7 5 1 8 r e v . 0 | p a g e 4 4 o f 1 2 8 p o w e r q u a l i t y m e a s u r e m e n t s z e r o - c r o s s i n g d e t e c t i o n e a c h a d e 7 5 1 8 h a s a z e r o - c r o s s i n g d e t e c t i o n c i r c u i t o n t h e v o l t a g e c h a n n e l . t h i s z e r o c r o s s i n g i s u s e d t o p r o d u c e a z e r o - c r o s s i n g i n t e r n a l s i g n a l ( z x ) a n d i s u s e d i n c a l i b r a t i o n m o d e . t h e z e r o - c r o s s i n g i s g e n e r a t e d b y d e f a u l t f r o m t h e o u t p u t o f l p f 1 . t h i s f i l t e r h a s a l o w c u t o f f f r e q u e n c y a n d i s i n t e n d e d f o r 5 0 h z a n d 6 0 h z s y s t e m s . i f n e e d e d , t h i s f i l t e r c a n b e d i s a b l e d t o a l l o w a h i g h e r f r e q u e n c y s i g n a l t o b e d e t e c t e d o r t o l i m i t t h e g r o u p d e l a y o f t h e d e t e c t i o n . i f t h e v o l t a g e i n p u t f u n d a m e n t a l f r e q u e n c y i s b e l o w 6 0 h z a n d a t i m e d e l a y i n z x d e t e c t i o n i s a c c e p t a b l e , i t i s r e c o m m e n d e d t o e n a b l e l p f 1 . e n a b l i n g l p f 1 l i m i t s t h e v a r i a b i l i t y i n t h e z x d e t e c t i o n b y e l i m i n a t i n g t h e h i g h f r e q u e n c y c o m p o n e n t s . f i g u r e 4 2 s h o w s h o w t h e z e r o - c r o s s i n g s i g n a l i s g e n e r a t e d . 1 , 2 , 4 , 8 , 1 6 a d c 2 r e f e r e n c e l p f 1 f ? 3 d b = 6 3 . 7 h z p g a 2 { g a i n [ 7 : 5 ] } v p v n v 2 z e r o c r o s s i n g z x h p f m o d e 1 [ 6 ] 4 3 . 2 4 @ 6 0 h z 1 . 0 0 . 7 3 z x v 2 l p f 1 0 7 3 2 7 - 0 4 2 f i g u r e 4 2 . z e r o - c r o s s i n g d e t e c t i o n o n t h e v o l t a g e c h a n n e l t h e z e r o - c r o s s i n g s i g n a l z x i s g e n e r a t e d f r o m t h e o u t p u t o f l p f 1 ( b y p a s s e d o r n o t ) . l p f 1 h a s a s i n g l e p o l e a t 6 3 . 7 h z ( a t m c l k = 4 . 0 9 6 m h z ) . a s a r e s u l t , t h e r e i s a p h a s e l a g b e t w e e n t h e a n a l o g i n p u t s i g n a l v 2 a n d t h e o u t p u t o f l p f 1 . t h e p h a s e l a g r e s p o n s e o f l p f 1 r e s u l t s i n a t i m e d e l a y o f a p p r o x i m a t e l y 2 m s ( @ 6 0 h z ) b e t w e e n t h e z e r o c r o s s i n g o n t h e a n a l o g i n p u t s o f t h e v o l t a g e c h a n n e l a n d z x d e t e c t i o n . t h e z e r o - c r o s s i n g d e t e c t i o n a l s o d r i v e s t h e z x f l a g i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) . i f t h e z x b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) i s s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e z x s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . z e r o - c r o s s i n g t i m e o u t t h e z e r o - c r o s s i n g d e t e c t i o n a l s o h a s a n a s s o c i a t e d t i m e o u t r e g i s t e r , z x t o u t . t h i s u n s i g n e d , 1 2 - b i t r e g i s t e r i s d e c r e m e n t e d ( 1 l s b ) e v e r y 1 6 0 / m c l k s e c o n d s . t h e r e g i s t e r i s r e s e t t o i t s u s e r - p r o g r a m m e d f u l l - s c a l e v a l u e e v e r y t i m e a z e r o c r o s s i n g i s d e t e c t e d o n t h e v o l t a g e c h a n n e l . t h e d e f a u l t p o w e r - o n v a l u e i n t h i s r e g i s t e r i s 0 x f f f . i f t h e i n t e r n a l r e g i s t e r d e c r e m e n t s t o 0 b e f o r e a z e r o c r o s s i n g i s d e t e c t e d i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) a n d t h e z x t o b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) i s s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e z x t o s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . t h e z x t o u t r e g i s t e r ( a d d r e s s 0 x 1 1 ) c a n b e w r i t t e n t o o r r e a d f r o m t h e 8 0 5 2 b y t h e u s e r ( s e e t h e e n e r g y m e a s u r e m e n t r e g i s t e r l i s t i n t a b l e 3 0 ) . t h e r e s o l u t i o n o f t h e r e g i s t e r i s 1 6 0 / m c l k s e c o n d s p e r l s b . t h u s , t h e m a x i m u m d e l a y f o r a n i n t e r r u p t i s 0 . 1 6 s e c ( 1 / m c l k 2 1 2 ) w h e n m c l k = 4 . 0 9 6 m h z . f i g u r e 4 3 s h o w s t h e m e c h a n i s m o f t h e z e r o - c r o s s i n g t i m e o u t d e t e c t i o n w h e n t h e l i n e v o l t a g e s t a y s a t a f i x e d d c l e v e l f o r m o r e t h a n m c l k / 1 6 0 z x t o u t s e c o n d s . 1 2 - b i t i n t e r n a l r e g i s t e r v a l u e z x t o u t z x t o f l a g b i t v o l t a g e c h a n n e l 0 7 3 2 7 - 0 4 3 f i g u r e 4 3 . z e r o - c r o s s i n g t i m e o u t d e t e c t i o n p e r i o d o r f r e q u e n c y m e a s u r e m e n t s t h e a d e 7 5 1 8 p r o v i d e s t h e p e r i o d o r f r e q u e n c y m e a s u r e m e n t o f t h e l i n e . t h e p e r i o d o r f r e q u e n c y m e a s u r e m e n t i s s e l e c t e d b y c l e a r i n g o r s e t t i n g t h e f r e q s e l b i t i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . t h e p e r i o d / f r e q u e n c y r e g i s t e r , p e r _ f r e q r e g i s t e r ( 0 x 0 a ) , i s a n u n s i g n e d 1 6 - b i t r e g i s t e r t h a t i s u p d a t e d e v e r y p e r i o d . i f l p f 1 i s e n a b l e d , a s e t t l i n g t i m e o f 1 . 8 s e c o n d s i s a s s o c i a t e d w i t h t h i s f i l t e r b e f o r e t h e m e a s u r e m e n t i s s t a b l e . w h e n t h e p e r i o d m e a s u r e m e n t i s s e l e c t e d , t h e m e a s u r e m e n t h a s a 2 . 4 4 s / l s b ( 4 . 0 9 6 m h z / 1 0 ) r e s o l u t i o n , w h i c h r e p r e s e n t s 0 . 0 1 4 % w h e n t h e l i n e f r e q u e n c y i s 6 0 h z . w h e n t h e l i n e f r e q u e n c y i s 6 0 h z , t h e v a l u e o f t h e p e r i o d r e g i s t e r i s a p p r o x i m a t e l y 0 d 6 8 2 7 . t h e l e n g t h o f t h e r e g i s t e r e n a b l e s t h e m e a s u r e m e n t o f l i n e f r e q u e n c i e s a s l o w a s 1 2 . 5 h z . t h e p e r i o d r e g i s t e r i s s t a b l e a t 1 l s b w h e n t h e l i n e i s e s t a b l i s h e d a n d t h e m e a s u r e m e n t d o e s n o t c h a n g e . w h e n t h e f r e q u e n c y m e a s u r e m e n t i s s e l e c t e d , t h e m e a s u r e m e n t h a s a 0 . 0 6 2 5 h z / l s b r e s o l u t i o n w h e n m c l k = 4 . 0 9 6 m h z , w h i c h r e p r e s e n t s 0 . 1 0 4 % w h e n t h e l i n e f r e q u e n c y i s 6 0 h z . w h e n t h e l i n e f r e q u e n c y i s 6 0 h z , t h e v a l u e o f t h e f r e q u e n c y r e g i s t e r i s 0 d 9 6 0 . t h e f r e q u e n c y r e g i s t e r i s s t a b l e a t 4 l s b w h e n t h e l i n e i s e s t a b l i s h e d a n d t h e m e a s u r e m e n t d o e s n o t c h a n g e .
a d e 7 5 1 8 r e v . 0 | p a g e 4 5 o f 1 2 8 l i n e v o l t a g e s a g d e t e c t i o n i n a d d i t i o n t o d e t e c t i o n o f t h e l o s s o f t h e l i n e v o l t a g e s i g n a l ( z e r o c r o s s i n g ) , t h e a d e 7 5 1 8 c a n a l s o b e p r o g r a m m e d t o d e t e c t w h e n t h e a b s o l u t e v a l u e o f t h e l i n e v o l t a g e d r o p s b e l o w a c e r t a i n p e a k v a l u e f o r a n u m b e r o f l i n e c y c l e s . t h i s c o n d i t i o n i s i l l u - s t r a t e d i n f i g u r e 4 4 . s a g r e s e t l o w w h e n v o l t a g e c h a n n e l e x c e e d s s a g l v l [ 1 5 : 0 ] a n d s a g f l a g r e s e t f u l l s c a l e s a g l v l [ 1 5 : 0 ] s a g f l a g s a g c y c [ 7 : 0 ] = 0 x 0 4 3 l i n e c y c l e s v o l t a g e c h a n n e l 0 7 3 2 7 - 0 4 4 f i g u r e 4 4 . s a g d e t e c t i o n f i g u r e 4 4 s h o w s t h e l i n e v o l t a g e f a l l i n g b e l o w a t h r e s h o l d t h a t i s s e t i n t h e s a g l e v e l r e g i s t e r ( s a g l v l [ 1 5 : 0 ] ) f o r t h r e e l i n e c y c l e s . t h e q u a n t i t i e s 0 a n d 1 a r e n o t v a l i d f o r t h e s a g c y c r e g i s t e r , a n d t h e c o n t e n t s r e p r e s e n t o n e m o r e t h a n t h e d e s i r e d n u m b e r o f f u l l l i n e c y c l e s . f o r e x a m p l e , w h e n t h e s a g c y c l e ( s a g c y c [ 7 : 0 ] ) c o n t a i n s 0 x 0 4 , f s a g i n t h e p o w e r m a n a g e m e n t i n t e r r u p t f l a g s f r ( i p s m f , 0 x f 8 ) i s s e t a t t h e e n d o f t h e t h i r d l i n e c y c l e a f t e r t h e l i n e v o l t a g e f a l l s b e l o w t h e t h r e s h o l d . i f t h e s a g e n a b l e b i t ( e s a g ) i n t h e p o w e r m a n a g e m e n t i n t e r r u p t e n a b l e s f r ( i p s m e , 0 x e c ) i s s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g p o w e r s u p p l y m a n a g e m e n t i n t e r r u p t . t h e p s m i n t e r r u p t s t a y s a c t i v e u n t i l t h e e s a g b i t i s c l e a r e d ( s e e t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t s e c t i o n ) . i n f i g u r e 4 4 , t h e s a g f l a g ( f s a g ) i s s e t o n t h e f i f t h l i n e c y c l e a f t e r t h e s i g n a l o n t h e v o l t a g e c h a n n e l f i r s t d r o p s b e l o w t h e t h r e s h o l d l e v e l . s a g l e v e l s e t t h e 2 - b y t e c o n t e n t s o f t h e s a g l e v e l r e g i s t e r ( s a g l v l , 0 x 1 4 ) a r e c o m p a r e d t o t h e a b s o l u t e v a l u e o f t h e o u t p u t f r o m l p f 1 . t h e r e f o r e , w h e n l p f 1 i s e n a b l e d , w r i t i n g 0 x 2 0 3 8 t o t h e s a g l e v e l r e g i s t e r p u t s t h e s a g d e t e c t i o n l e v e l a t f u l l s c a l e ( s e e f i g u r e 4 4 ) . w r i t i n g 0 x 0 0 o r 0 x 0 1 p u t s t h e s a g d e t e c t i o n l e v e l a t 0 . t h e s a g l e v e l r e g i s t e r i s c o m p a r e d t o t h e i n p u t o f t h e z x d e t e c t i o n , a n d d e t e c t i o n i s m a d e w h e n t h e c o n t e n t s o f t h e s a g l e v e l r e g i s t e r a r e g r e a t e r . p e a k d e t e c t i o n t h e a d e 7 5 1 8 c a n a l s o b e p r o g r a m m e d t o d e t e c t w h e n t h e a b s o l u t e v a l u e o f t h e v o l t a g e o r c u r r e n t c h a n n e l e x c e e d s a s p e c i f i e d p e a k v a l u e . f i g u r e 4 5 i l l u s t r a t e s t h e b e h a v i o r o f t h e p e a k d e t e c t i o n f o r t h e v o l t a g e c h a n n e l . b o t h v o l t a g e a n d c u r r e n t c h a n n e l s a r e m o n i t o r e d a t t h e s a m e t i m e . p k v r e s e t l o w w h e n m i r q s t h s f r i s r e a d v p k l v l [ 1 5 : 0 ] v 2 r e s e t b i t p k v i n m i r q s t h s f r p k v i n t e r r u p t f l a g 0 7 3 2 7 - 0 4 5 f i g u r e 4 5 . p e a k l e v e l d e t e c t i o n f i g u r e 4 5 s h o w s a l i n e v o l t a g e e x c e e d i n g a t h r e s h o l d t h a t i s s e t i n t h e v o l t a g e p e a k r e g i s t e r ( v p k l v l [ 1 5 : 0 ] ) . t h e v o l t a g e p e a k e v e n t i s r e c o r d e d b y s e t t i n g t h e p k v f l a g i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) . i f t h e p k v e n a b l e b i t i s s e t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . s i m i l a r l y , t h e c u r r e n t p e a k e v e n t i s r e c o r d e d b y s e t t i n g t h e p k i f l a g i n i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e p k v o r p k i s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . p e a k l e v e l s e t t h e c o n t e n t s o f t h e v p k l v l a n d i p k l v l r e g i s t e r s a r e c o m p a r e d t o t h e a b s o l u t e v a l u e o f t h e v o l t a g e a n d t h e 2 m s b s o f t h e c u r r e n t c h a n n e l , r e s p e c t i v e l y . t h u s , f o r e x a m p l e , t h e n o m i n a l m a x i m u m c o d e f r o m t h e c u r r e n t c h a n n e l a d c w i t h a f u l l - s c a l e s i g n a l i s 0 x 2 8 f 5 c 2 ( s e e t h e c u r r e n t c h a n n e l a d c s e c t i o n ) . t h e r e f o r e , w r i t i n g 0 x 2 8 f 5 t o t h e i p k l v l r e g i s t e r p u t s t h e p e a k d e t e c t i o n l e v e l o f t h e c u r r e n t c h a n n e l a t f u l l s c a l e a n d s e t s t h e c u r r e n t p e a k d e t e c t i o n t o i t s l e a s t s e n s i t i v e v a l u e . w r i t i n g 0 x 0 0 p u t s t h e c u r r e n t c h a n n e l d e t e c t i o n l e v e l a t 0 . t h e d e t e c t i o n i s d o n e b y c o m p a r i n g t h e c o n t e n t s o f t h e i p k l v l r e g i s t e r t o t h e i n c o m i n g c u r r e n t c h a n n e l s a m p l e . t h e p k i f l a g i n d i c a t e s t h a t t h e p e a k l e v e l i s e x c e e d e d . i f t h e p k i o r p k v b i t i s s e t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . p e a k l e v e l r e c o r d e a c h a d e 7 5 1 8 r e c o r d s t h e m a x i m u m a b s o l u t e v a l u e r e a c h e d b y t h e v o l t a g e a n d c u r r e n t c h a n n e l s i n t w o d i f f e r e n t r e g i s t e r s , i p e a k a n d v p e a k , r e s p e c t i v e l y . e a c h r e g i s t e r i s a 2 4 - b i t u n s i g n e d r e g i s t e r t h a t i s u p d a t e d e a c h t i m e t h e a b s o l u t e v a l u e o f t h e w a v e f o r m s a m p l e f r o m t h e c o r r e s p o n d i n g c h a n n e l i s a b o v e t h e v a l u e s t o r e d i n t h e v p e a k o r i p e a k r e g i s t e r . t h e c o n t e n t s o f t h e v p e a k r e g i s t e r c o r r e s p o n d t o t h e m a x i m u m a b s o l u t e v a l u e o b s e r v e d o n t h e v o l t a g e c h a n n e l i n p u t . t h e c o n t e n t s o f i p e a k a n d v p e a k r e p r e s e n t t h e m a x i m u m a b s o l u t e v a l u e o b s e r v e d o n t h e c u r r e n t a n d v o l t a g e i n p u t , r e s p e c t i v e l y . r e a d i n g t h e r s t v p e a k a n d r s t i p e a k r e g i s t e r s c l e a r s t h e i r r e s p e c t i v e c o n t e n t s a f t e r t h e r e a d o p e r a t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 4 6 o f 1 2 8 p h a s e c o m p e n s a t i o n t h e a d e 7 5 1 8 m u s t w o r k w i t h t r a n s d u c e r s t h a t c a n h a v e i n h e r e n t p h a s e e r r o r s . f o r e x a m p l e , a p h a s e e r r o r o f 0 . 1 t o 0 . 3 i s n o t u n c o m m o n f o r a c u r r e n t t r a n s f o r m e r ( c t ) . t h e s e p h a s e e r r o r s c a n v a r y f r o m p a r t t o p a r t , a n d t h e y m u s t b e c o r r e c t e d t o p e r f o r m a c c u r a t e p o w e r c a l c u l a t i o n s . t h e e r r o r s a s s o c i a t e d w i t h p h a s e m i s m a t c h a r e p a r t i c u l a r l y n o t i c e a b l e a t l o w p o w e r f a c t o r s . t h e a d e 7 5 1 8 p r o v i d e s a m e a n s o f d i g i t a l l y c a l i b r a t i n g t h e s e s m a l l p h a s e e r r o r s . t h e p a r t a l l o w s a s m a l l t i m e d e l a y o r t i m e a d v a n c e t o b e i n t r o d u c e d i n t o t h e s i g n a l p r o c e s s i n g c h a i n t o c o m p e n s a t e f o r s m a l l p h a s e e r r o r s . b e c a u s e t h e c o m p e n s a t i o n i s i n t i m e , t h i s t e c h n i q u e s h o u l d o n l y b e u s e d f o r s m a l l p h a s e e r r o r s i n t h e r a n g e o f 0 . 1 t o 0 . 5 . c o r r e c t i n g l a r g e p h a s e e r r o r s u s i n g a t i m e s h i f t t e c h n i q u e c a n i n t r o d u c e s i g n i f i c a n t p h a s e e r r o r s a t h i g h e r h a r m o n i c s . t h e p h a s e c a l i b r a t i o n r e g i s t e r ( p h c a l [ 7 : 0 ] ) i s a t w o s c o m p l e m e n t , s i g n e d , s i n g l e - b y t e r e g i s t e r t h a t h a s v a l u e s r a n g i n g f r o m 0 x 8 2 ( ? 1 2 6 d ) t o 0 x 6 8 ( + 1 0 4 d ) . t h e p h c a l r e g i s t e r i s c e n t e r e d a t 0 x 4 0 , m e a n i n g t h a t w r i t i n g 0 x 4 0 t o t h e r e g i s t e r r e s u l t s i n 0 d e l a y . b y c h a n g i n g t h i s r e g i s t e r , t h e t i m e d e l a y i n t h e v o l t a g e c h a n n e l s i g n a l p a t h c a n c h a n g e f r o m ? 2 3 1 . 9 3 s t o + 4 8 . 8 3 s ( m c l k = 4 . 0 9 6 m h z ) . o n e l s b i s e q u i v a l e n t t o a 1 . 2 2 s ( 4 . 0 9 6 m h z / 5 ) t i m e d e l a y o r a d v a n c e . a l i n e f r e q u e n c y o f 6 0 h z g i v e s a p h a s e r e s o l u t i o n o f 0 . 0 2 6 a t t h e f u n d a m e n t a l ( t h a t i s , 3 6 0 1 . 2 2 s 6 0 h z ) . f i g u r e 4 6 i l l u s t r a t e s h o w t h e p h a s e c o m p e n s a t i o n i s u s e d t o r e m o v e a 0 . 1 p h a s e l e a d i n t h e c u r r e n t c h a n n e l d u e t o t h e e x t e r n a l t r a n s d u c e r . t o c a n c e l t h e l e a d ( 0 . 1 ) i n t h e c u r r e n t c h a n n e l , a p h a s e l e a d m u s t a l s o b e i n t r o d u c e d i n t o t h e v o l t a g e c h a n n e l . t h e r e s o l u t i o n o f t h e p h a s e a d j u s t m e n t a l l o w s t h e i n t r o d u c t i o n o f a p h a s e l e a d i n i n c r e m e n t s o f 0 . 0 2 6 . t h e p h a s e l e a d i s a c h i e v e d b y i n t r o d u c i n g a t i m e a d v a n c e i n t o t h e v o l t a g e c h a n n e l . a t i m e a d v a n c e o f 4 . 8 8 s i s m a d e b y w r i t i n g ? 4 ( 0 x 3 c ) t o t h e t i m e d e l a y b l o c k , t h u s r e d u c i n g t h e a m o u n t o f t i m e d e l a y b y 4 . 8 8 s , o r e q u i v a l e n t l y , a p h a s e l e a d o f a p p r o x i m a t e l y 0 . 1 a t a l i n e f r e q u e n c y o f 6 0 h z ( 0 x 3 c r e p r e s e n t s ? 4 b e c a u s e t h e r e g i s t e r i s c e n t e r e d w i t h 0 a t 0 x 4 0 ) . 1 1 0 1 0 0 1 7 0 p g a 1 i p i n i a d c 1 h p f 2 4 p g a 2 v p v n v a d c 2 2 4 l p f 2 v i 6 0 h z 0 . 1 i v c h a n n e l 2 d e l a y r e d u c e d b y 4 . 4 8 s ( 0 . 1 l e a d a t 6 0 h z ) 0 x 0 b i n p h c a l [ 7 : 0 ] p h c a l [ 7 : 0 ] ? 2 3 1 . 9 3 s t o + 4 8 . 8 3 s 6 0 h z 1 1 d e l a y b l o c k 1 . 2 2 s / l s b 0 7 3 2 7 - 0 4 6 f i g u r e 4 6 . p h a s e c a l i b r a t i o n r m s c a l c u l a t i o n t h e r o o t m e a n s q u a r e ( r m s ) v a l u e o f a c o n t i n u o u s s i g n a l v ( t ) i s d e f i n e d a s 3 u t r m s d t t v t v 0 2 ) ( 1 ( 1 ) f o r t i m e s a m p l i n g s i g n a l s , r m s c a l c u l a t i o n i n v o l v e s s q u a r i n g t h e s i g n a l , t a k i n g t h e a v e r a g e , a n d o b t a i n i n g t h e s q u a r e r o o t . t h e a d e 7 5 1 8 i m p l e m e n t s t h i s m e t h o d b y s e r i a l l y s q u a r i n g t h e i n p u t , a v e r a g i n g t h e m , a n d t h e n t a k i n g t h e s q u a r e r o o t o f t h e a v e r a g e . t h e a v e r a g i n g p a r t o f t h i s s i g n a l p r o c e s s i n g i s d o n e b y i m p l e m e n t - i n g a l o w - p a s s f i l t e r ( l p f 3 i n f i g u r e 4 7 , f i g u r e 4 8 , a n d f i g u r e 5 0 ) . t h i s l p f h a s a ? 3 d b c u t o f f f r e q u e n c y o f 2 h z w h e n m c l k = 4 . 0 9 6 m h z . ) s i n ( 2 t v t v zu ( 2 ) w h e r e v i s t h e r m s v o l t a g e . t v v t v z 2 c o s ) ( 2 2 2 ( 3 ) w h e n t h i s s i g n a l g o e s t h r o u g h l p f 3 , t h e c o s ( 2  t ) t e r m i s a t t e n u - a t e d a n d o n l y t h e d c t e r m v r m s 2 g o e s t h r o u g h ( s h o w n a s v 2 i n f i g u r e 4 7 ) . v l p f 3 i n p u t v 2 ( t ) = v 2 ? v 2 c o s ( 2 & t ) v 2 ( t ) = v 2 v ( t ) = 2 v s i n ( & t ) 0 7 3 2 7 - 0 4 7 f i g u r e 4 7 . r m s s i g n a l p r o c e s s i n g t h e i r m s s i g n a l c a n b e r e a d f r o m t h e w a v e f o r m r e g i s t e r b y s e t t i n g t h e w a v m o d e r e g i s t e r ( 0 x 0 d ) a n d s e t t i n g t h e w f s m b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) . l i k e t h e c u r r e n t a n d v o l t a g e c h a n n e l s w a v e f o r m s a m p l i n g m o d e s , t h e w a v e f o r m d a t a i s a v a i l a b l e a t a s a m p l e r a t e o f 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s . i t i s i m p o r t a n t t o n o t e t h a t w h e n t h e c u r r e n t i n p u t i s l a r g e r t h a n 4 0 % o f f u l l s c a l e , t h e i r m s w a v e f o r m s a m p l e r e g i s t e r d o e s n o t r e p r e s e n t t h e t r u e p r o c e s s e d r m s v a l u e . t h e r m s v a l u e p r o c e s s e d w i t h t h i s l e v e l o f i n p u t i s l a r g e r t h a n t h e 2 4 - b i t r e a d b y t h e w a v e - f o r m r e g i s t e r , m a k i n g t h e v a l u e r e a d t r u n c a t e d o n t h e h i g h e n d .
a d e 7 5 1 8 r e v . 0 | p a g e 4 7 o f 1 2 8 c u r r e n t c h a n n e l r m s c a l c u l a t i o n e a c h a d e 7 5 1 8 s i m u l t a n e o u s l y c a l c u l a t e s t h e r m s v a l u e s f o r t h e c u r r e n t a n d v o l t a g e c h a n n e l s i n d i f f e r e n t r e g i s t e r s . f i g u r e 4 8 s h o w s t h e d e t a i l o f t h e s i g n a l p r o c e s s i n g c h a i n f o r t h e r m s c a l c u l a t i o n o n t h e c u r r e n t c h a n n e l . t h e c u r r e n t c h a n n e l r m s v a l u e i s p r o c e s s e d f r o m t h e s a m p l e s u s e d i n t h e c u r r e n t c h a n n e l w a v e f o r m s a m p l i n g m o d e a n d i s s t o r e d i n a n u n s i g n e d 2 4 - b i t r e g i s t e r ( i r m s ) . o n e l s b o f t h e c u r r e n t c h a n n e l r m s r e g i s t e r i s e q u i v a l e n t t o o n e l s b o f a c u r r e n t c h a n n e l w a v e f o r m s a m p l e . t h e u p d a t e r a t e o f t h e c u r r e n t c h a n n e l r m s m e a s u r e m e n t i s 4 . 0 9 6 m h z / 5 . t o m i n i m i z e n o i s e i n t h e r e a d i n g o f t h e r e g i s t e r , t h e i r m s r e g i s t e r c a n a l s o b e c o n f i g u r e d t o u p d a t e o n l y w i t h t h e z e r o c r o s s i n g o f t h e v o l t a g e i n p u t . t h i s c o n f i g u r a t i o n i s d o n e b y s e t t i n g t h e z x r m s b i t i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . w i t h t h e d i f f e r e n t s p e c i f i e d f u l l - s c a l e a n a l o g i n p u t s i g n a l p g a 1 v a l u e s , t h e a d c p r o d u c e s a n o u t p u t c o d e t h a t i s a p p r o x i m a t e l y 0 d 2 , 1 4 7 , 4 8 3 ( p g a 1 = 1 ) o r 0 d 2 , 6 8 4 , 3 5 4 ( p g a 1 = 2 , 4 , 8 , o r 1 6 ) . s e e t h e c u r r e n t c h a n n e l a d c s e c t i o n . s i m i l a r l y , t h e e q u i v a l e n t r m s v a l u e o f a f u l l - s c a l e a c s i g n a l i s 0 d 1 , 5 1 8 , 4 9 9 ( 0 x 1 7 2 b a 3 ) w h e n p g a = 1 a n d 0 d 1 , 8 9 8 , 1 2 4 ( 0 x 1 c f 6 8 c ) w h e n p g a 1 = 2 , 4 , 8 , o r 1 6 . t h e c u r r e n t r m s m e a s u r e m e n t p r o v i d e d i n t h e a d e 7 5 1 8 i s a c c u r a t e t o w i t h i n 0 . 5 % f o r s i g n a l i n p u t s b e t w e e n f u l l s c a l e a n d f u l l s c a l e / 5 0 0 . t h e c o n v e r s i o n f r o m t h e r e g i s t e r v a l u e t o a m p s m u s t b e d o n e e x t e r n a l l y i n t h e m i c r o p r o c e s s o r u s i n g a n a m p s / l s b c o n s t a n t . c u r r e n t c h a n n e l r m s o f f s e t c o m p e n s a t i o n t h e a d e 7 5 1 8 i n c o r p o r a t e s a c u r r e n t c h a n n e l r m s o f f s e t c o m p e n s a t i o n r e g i s t e r ( i r m s o s ) . t h i s i s a 1 2 - b i t s i g n e d r e g i s t e r t h a t c a n b e u s e d t o r e m o v e o f f s e t i n t h e c u r r e n t c h a n n e l r m s c a l c u l a t i o n . a n o f f s e t c a n e x i s t i n t h e r m s c a l c u l a t i o n d u e t o i n p u t n o i s e s t h a t a r e i n t e g r a t e d i n t o t h e d c c o m p o n e n t o f v 2 ( t ) . o n e l s b o f t h e c u r r e n t c h a n n e l r m s o f f s e t i s e q u i v a l e n t t o 1 6 , 3 8 4 l s b s o f t h e s q u a r e o f t h e c u r r e n t c h a n n e l r m s r e g i s t e r . a s s u m i n g t h a t t h e m a x i m u m v a l u e f r o m t h e c u r r e n t c h a n n e l r m s c a l c u l a t i o n i s 0 d 1 , 8 9 8 , 1 2 4 w i t h f u l l - s c a l e a c i n p u t s , t h e n 1 l s b o f t h e c u r r e n t c h a n n e l r m s o f f s e t r e p r e s e n t s 0 . 2 3 % o f m e a s u r e m e n t e r r o r a t ? 6 0 d b d o w n f r o m f u l l s c a l e . 7 6 8 , 3 2 2 u i r m s o s i i 0 r m s r m s ( 4 ) w h e r e i r m s 0 i s t h e r m s m e a s u r e m e n t w i t h o u t o f f s e t c o r r e c t i o n . i r m s ( t ) 0 x 0 0 + i r m s o s [ 1 1 : 0 ] i r m s [ 2 3 : 0 ] 2 2 6 2 2 5 s g n 2 2 7 2 1 7 2 1 6 2 1 8 2 4 2 4 c u r r e n t c h a n n e l w a v e f o r m d a t a r a n g e 0 x d 7 0 a 3 e 0 x 0 0 0 0 0 0 0 x 2 8 f 5 c 2 h p f 1 l p f 3 h p f i p 0 7 3 2 7 - 0 4 8 f i g u r e 4 8 . c u r r e n t c h a n n e l r m s s i g n a l p r o c e s s i n g w i t h p g a 1 = 1 , 2 , 4 , 8 , o r 1 6
a d e 7 5 1 8 r e v . 0 | p a g e 4 8 o f 1 2 8 v o l t a g e c h a n n e l r m s c a l c u l a t i o n f i g u r e 5 0 s h o w s d e t a i l s o f t h e s i g n a l p r o c e s s i n g c h a i n f o r t h e r m s c a l c u l a t i o n o n t h e v o l t a g e c h a n n e l . t h e v o l t a g e c h a n n e l r m s v a l u e i s p r o c e s s e d f r o m t h e s a m p l e s u s e d i n t h e v o l t a g e c h a n n e l w a v e f o r m s a m p l i n g m o d e a n d i s s t o r e d i n t h e u n s i g n e d 2 4 - b i t v r m s r e g i s t e r . t h e u p d a t e r a t e o f t h e v o l t a g e c h a n n e l r m s m e a s u r e m e n t i s m c l k / 5 . t o m i n i m i z e n o i s e i n t h e r e a d i n g o f t h e r e g i s t e r , t h e v r m s r e g i s t e r c a n a l s o b e c o n f i g u r e d t o u p d a t e o n l y w i t h t h e z e r o c r o s s i n g o f t h e v o l t a g e i n p u t . t h i s c o n f i g u r a t i o n i s d o n e b y s e t t i n g t h e z x r m s b i t i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . w i t h t h e s p e c i f i e d f u l l - s c a l e a c a n a l o g i n p u t s i g n a l o f 0 . 4 v , t h e o u t p u t f r o m t h e l p f 1 i n f i g u r e 5 0 s w i n g s b e t w e e n 0 x 2 8 f 5 a n d 0 x d 7 0 b a t 6 0 h z ( s e e t h e v o l t a g e c h a n n e l a d c s e c t i o n ) . t h e e q u i v a l e n t r m s v a l u e o f t h i s f u l l - s c a l e a c s i g n a l i s a p p r o x i m a t e l y 0 d 1 , 8 9 8 , 1 2 4 ( 0 x 1 c f 6 8 c ) i n t h e v r m s r e g i s t e r . t h e v o l t a g e r m s m e a s u r e m e n t p r o v i d e d i n t h e a d e 7 5 1 8 i s a c c u r a t e t o w i t h i n 0 . 5 % f o r s i g n a l i n p u t b e t w e e n f u l l s c a l e a n d f u l l s c a l e / 2 0 . t h e c o n v e r s i o n f r o m t h e r e g i s t e r v a l u e t o v o l t s m u s t b e d o n e e x t e r n a l l y i n t h e m i c r o p r o c e s s o r u s i n g a v / l s b c o n s t a n t . v o l t a g e c h a n n e l r m s o f f s e t c o m p e n s a t i o n t h e a d e 7 5 1 8 i n c o r p o r a t e s a v o l t a g e c h a n n e l r m s o f f s e t c o m p e n s a - t i o n r e g i s t e r ( v r m s o s ) . t h i s i s a 1 2 - b i t s i g n e d r e g i s t e r t h a t c a n b e u s e d t o r e m o v e o f f s e t i n t h e v o l t a g e c h a n n e l r m s c a l c u l a t i o n . a n o f f s e t c a n e x i s t i n t h e r m s c a l c u l a t i o n d u e t o i n p u t n o i s e s a n d d c o f f s e t i n t h e i n p u t s a m p l e s . o n e l s b o f t h e v o l t a g e c h a n n e l r m s o f f s e t i s e q u i v a l e n t t o 6 4 l s b s o f t h e r m s r e g i s t e r . a s s u m i n g t h a t t h e m a x i m u m v a l u e f r o m t h e v o l t a g e c h a n n e l r m s c a l c u l a t i o n i s 0 d 1 , 8 9 8 , 1 2 4 w i t h f u l l - s c a l e a c i n p u t s , t h e n 1 l s b o f t h e v o l t a g e c h a n n e l r m s o f f s e t r e p r e s e n t s 3 . 3 7 % o f m e a s u r e m e n t e r r o r a t ? 6 0 d b d o w n f r o m f u l l s c a l e . v r m s = v r m s 0 + 6 4 v r m s o s ( 5 ) w h e r e v r m s 0 i s t h e r m s m e a s u r e m e n t w i t h o u t o f f s e t c o r r e c t i o n . a c t i v e p o w e r c a l c u l a t i o n a c t i v e p o w e r i s d e f i n e d a s t h e r a t e o f e n e r g y f l o w f r o m s o u r c e t o l o a d . i t i s t h e p r o d u c t o f t h e v o l t a g e a n d c u r r e n t w a v e f o r m s . t h e r e s u l t i n g w a v e f o r m i s c a l l e d t h e i n s t a n t a n e o u s p o w e r s i g n a l a n d i s e q u a l t o t h e r a t e o f e n e r g y f l o w a t e v e r y i n s t a n t o f t i m e . t h e u n i t o f p o w e r i s w a t t o r j o u l e s / s e c o n d . e q u a t i o n 8 g i v e s a n e x p r e s s i o n f o r t h e i n s t a n t a n e o u s p o w e r s i g n a l i n a n a c s y s t e m . ) s i n ( 2 t v t v zu ( 6 ) ) s i n ( 2 t i t i zu ( 7 ) w h e r e : v i s t h e r m s v o l t a g e . i i s t h e r m s c u r r e n t . ) ( ) ( ) ( t i t v t p u ) 2 c o s ( ) ( t v i v i t p z  ( 8 ) t h e a v e r a g e p o w e r o v e r a n i n t e g r a l n u m b e r o f l i n e c y c l e s ( n ) i s g i v e n b y t h e e x p r e s s i o n i n e q u a t i o n 9 . 3 n t v i d t t p n t p 0 ) ( 1 ( 9 ) w h e r e : t i s t h e l i n e c y c l e p e r i o d . p i s r e f e r r e d t o a s t h e a c t i v e o r r e a l p o w e r . n o t e t h a t t h e a c t i v e p o w e r i s e q u a l t o t h e d c c o m p o n e n t o f t h e i n s t a n t a n e o u s p o w e r s i g n a l p ( t ) i n e q u a t i o n 9 , t h a t i s , v i . t h i s i s t h e r e l a t i o n s h i p u s e d t o c a l c u l a t e a c t i v e p o w e r i n t h e a d e 7 5 1 8 . t h e i n s t a n t a n e o u s p o w e r s i g n a l p ( t ) i s g e n e r a t e d b y m u l t i p l y i n g t h e c u r r e n t a n d v o l t a g e s i g n a l s . t h e d c c o m p o n e n t o f t h e i n s t a n t a n e o u s p o w e r s i g n a l i s t h e n e x t r a c t e d b y l p f 2 ( l o w - p a s s f i l t e r ) t o o b t a i n t h e a c t i v e p o w e r i n f o r m a t i o n . t h i s p r o c e s s i s i l l u s t r a t e d i n f i g u r e 4 9 . i n s t a n t a n e o u s p o w e r s i g n a l p ( t ) = v i ? v i c o s ( 2 & t ) a c t i v e r e a l p o w e r s i g n a l = v i 0 x 1 9 9 9 9 a v i 0 x c c c c d 0 x 0 0 0 0 0 c u r r e n t i ( t ) = 2 i s i n ( & t ) v o l t a g e v ( t ) = 2 v s i n ( & t ) 0 7 3 2 7 - 0 5 0 f i g u r e 4 9 . a c t i v e p o w e r c a l c u l a t i o n b e c a u s e l p f 2 d o e s n o t h a v e a n i d e a l b r i c k w a l l f r e q u e n c y r e s p o n s e ( s e e f i g u r e 5 1 ) , t h e a c t i v e p o w e r s i g n a l h a s s o m e r i p p l e d u e t o t h e i n s t a n t a n e o u s p o w e r s i g n a l . t h i s r i p p l e i s s i n u s o i d a l a n d h a s a f r e q u e n c y e q u a l t o t w i c e t h e l i n e f r e q u e n c y . b e c a u s e o f i t s s i n u s o i d a l n a t u r e , t h e r i p p l e i s r e m o v e d w h e n t h e a c t i v e p o w e r s i g n a l i s i n t e g r a t e d t o c a l c u l a t e e n e r g y ( s e e t h e a c t i v e e n e r g y c a l c u l a t i o n s e c t i o n ) . v r m s x [ 2 3 : 0 ] l p f 3 l p f 1 v o l t a g e c h a n n e l 0 x 2 8 f 5 c 2 0 x 0 0 + + v r m s o s [ 1 1 : 0 ] v o l t a g e s i g n a l ( v ( t ) ) 0 x 2 8 f 5 0 x 0 0 x d 7 0 b 2 1 6 s g n 2 1 5 2 7 2 6 2 8 0 7 3 2 7 - 0 4 9 f i g u r e 5 0 . v o l t a g e c h a n n e l r m s s i g n a l p r o c e s s i n g
a d e 7 5 1 8 r e v . 0 | p a g e 4 9 o f 1 2 8 f r e q u e n c y ( h z ) ? 2 4 1 a t t e n u a t i o n ( d b ) ? 2 0 3 1 0 3 0 1 0 0 ? 1 2 ? 1 6 ? 8 ? 4 0 0 7 3 2 7 - 0 5 1 f i g u r e 5 1 . f r e q u e n c y r e s p o n s e o f l p f 2 a c t i v e p o w e r g a i n c a l i b r a t i o n f i g u r e 5 2 s h o w s t h e s i g n a l p r o c e s s i n g c h a i n f o r t h e a c t i v e p o w e r c a l c u l a t i o n i n t h e a d e 7 5 1 8 . a s e x p l a i n e d p r e v i o u s l y , t h e a c t i v e p o w e r i s c a l c u l a t e d b y f i l t e r i n g t h e o u t p u t o f t h e m u l t i p l i e r w i t h a l o w - p a s s f i l t e r . n o t e t h a t w h e n r e a d i n g t h e w a v e f o r m s a m p l e s f r o m t h e o u t p u t o f l p f 2 , t h e g a i n o f t h e a c t i v e e n e r g y c a n b e a d j u s t e d b y u s i n g t h e m u l t i p l i e r a n d w a t t g a i n r e g i s t e r ( w g a i n [ 1 1 : 0 ] ) . t h e g a i n i s a d j u s t e d b y w r i t i n g a t w o s c o m p l e m e n t 1 2 - b i t w o r d t o t h e w a t t g a i n r e g i s t e r . e q u a t i o n 1 0 s h o w s h o w t h e g a i n a d j u s t m e n t i s r e l a t e d t o t h e c o n t e n t s o f t h e w a t t g a i n r e g i s t e r . ? ?1 ? ? ? ? ? - u 1 2 2 1 w g a i n p o w e r a c t i v e w g a i n o u t p u t ( 1 0 ) f o r e x a m p l e , w h e n 0 x 7 f f i s w r i t t e n t o t h e w a t t g a i n r e g i s t e r , t h e p o w e r o u t p u t i s s c a l e d u p b y 5 0 % ( 0 x 7 f f = 2 0 4 7 d , 2 0 4 7 / 2 1 2 = 0 . 5 ) . s i m i l a r l y , 0 x 8 0 0 = ? 2 0 4 8 d ( s i g n e d , t w o s c o m p l e m e n t ) a n d p o w e r o u t p u t i s s c a l e d b y ? 5 0 % . e a c h l s b s c a l e s t h e p o w e r o u t p u t b y 0 . 0 2 4 4 % . t h e m i n i m u m o u t p u t r a n g e i s g i v e n w h e n t h e w a t t g a i n r e g i s t e r c o n t e n t s a r e e q u a l t o 0 x 8 0 0 a n d t h e m a x i m u m r a n g e i s g i v e n b y w r i t i n g 0 x 7 f f t o t h e w a t t g a i n r e g i s t e r . t h i s w a t t g a i n r e g i s t e r c a n b e u s e d t o c a l i b r a t e t h e a c t i v e p o w e r ( o r e n e r g y ) c a l c u l a t i o n i n t h e a d e 7 5 1 8 . a c t i v e p o w e r o f f s e t c a l i b r a t i o n t h e a d e 7 5 1 8 a l s o i n c o r p o r a t e s a n a c t i v e p o w e r o f f s e t r e g i s t e r ( w a t t o s [ 1 5 : 0 ] ) . i t i s a s i g n e d , t w o s c o m p l e m e n t , 1 6 - b i t r e g i s t e r t h a t c a n b e u s e d t o r e m o v e o f f s e t s i n t h e a c t i v e p o w e r c a l c u l a t i o n ( s e e f i g u r e 4 9 ) . a n o f f s e t c a n e x i s t i n t h e p o w e r c a l c u l a t i o n d u e t o c r o s s t a l k b e t w e e n c h a n n e l s o n t h e p c b o r i n t h e i c i t s e l f . t h e o f f s e t c a l i b r a t i o n a l l o w s t h e c o n t e n t s o f t h e a c t i v e p o w e r r e g i s t e r t o b e m a i n t a i n e d a t 0 w h e n n o p o w e r i s b e i n g c o n s u m e d . t h e 2 5 6 l s b s ( w a t t o s = 0 x 0 1 0 0 ) w r i t t e n t o t h e a c t i v e p o w e r o f f s e t r e g i s t e r a r e e q u i v a l e n t t o 1 l s b i n t h e w a v e f o r m s a m p l e r e g i s t e r . a s s u m i n g t h e a v e r a g e v a l u e , o u t p u t f r o m l p f 2 i s 0 x c c c c d ( 8 3 8 , 8 6 1 d ) w h e n i n p u t s o n t h e v o l t a g e a n d c u r r e n t c h a n n e l s a r e b o t h a t f u l l s c a l e . a t ? 6 0 d b b e l o w f u l l s c a l e o n t h e c u r r e n t c h a n n e l ( 1 / 1 0 0 0 o f t h e c u r r e n t c h a n n e l f u l l - s c a l e i n p u t ) , t h e a v e r a g e w o r d v a l u e o u t p u t f r o m l p f 2 i s 8 3 8 . 8 6 1 ( 8 3 8 , 8 6 1 / 1 0 0 0 ) . o n e l s b i n t h e l p f 2 o u t p u t h a s a m e a s u r e m e n t e r r o r o f 1 / 8 3 8 . 8 6 1 1 0 0 % = 0 . 1 1 9 % o f t h e a v e r a g e v a l u e . t h e a c t i v e p o w e r o f f s e t r e g i s t e r h a s a r e s o l u t i o n e q u a l t o 1 / 2 5 6 l s b o f t h e w a v e f o r m r e g i s t e r . t h e r e f o r e , t h e p o w e r o f f s e t c o r r e c t i o n r e s o l u t i o n i s 0 . 0 0 0 4 6 4 % / l s b ( 0 . 1 1 9 % / 2 5 6 ) a t ? 6 0 d b . a c t i v e p o w e r s i g n d e t e c t i o n t h e a d e 7 5 1 8 d e t e c t s a c h a n g e o f s i g n i n t h e a c t i v e p o w e r . t h e a p s i g n f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) r e c o r d s w h e n a c h a n g e o f s i g n h a s o c c u r r e d a c c o r d i n g t o b i t a p s i g n i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i f t h e a p s i g n f l a g i s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e a p s i g n s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . w h e n a p s i g n i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s c l e a r e d ( d e f a u l t ) , t h e a p s i g n f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t w h e n a t r a n s i t i o n f r o m p o s i t i v e t o n e g a t i v e a c t i v e p o w e r h a s o c c u r r e d . i f a p s i g n i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , t h e a p s i g n f l a g i n t h e m i r q s t l s f r i s s e t w h e n a t r a n s i t i o n f r o m n e g a t i v e t o p o s i t i v e a c t i v e p o w e r o c c u r s . a c t i v e p o w e r n o l o a d d e t e c t i o n t h e a d e 7 5 1 8 i n c l u d e s a n o l o a d t h r e s h o l d f e a t u r e o n t h e a c t i v e e n e r g y t h a t e l i m i n a t e s a n y c r e e p e f f e c t s i n t h e m e t e r . t h e p a r t a c c o m p l i s h e s t h i s b y n o t a c c u m u l a t i n g e n e r g y i f t h e m u l t i p l i e r o u t p u t i s b e l o w t h e n o l o a d t h r e s h o l d . w h e n t h e a c t i v e p o w e r i s b e l o w t h e n o l o a d t h r e s h o l d , t h e a p n o l o a d f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t . i f t h e a p n o l o a d b i t i s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e a p n o l o a d s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . t h e n o l o a d t h r e s h o l d l e v e l i s s e l e c t a b l e b y s e t t i n g t h e a p n o l o a d b i t s i n t h e n l m o d e r e g i s t e r ( 0 x 0 e ) . s e t t i n g t h e s e b i t s t o 0 b 0 0 d i s a b l e s t h e n o l o a d d e t e c t i o n , a n d s e t t i n g t h e m t o 0 b 0 1 , 0 b 1 0 , o r 0 b 1 1 s e t s t h e n o l o a d d e t e c t i o n t h r e s h o l d t o 0 . 0 1 5 % , 0 . 0 0 7 5 % , o r 0 . 0 0 3 7 % , r e s p e c t i v e l y , o f t h e m u l t i p l i e r ? s f u l l - s c a l e o u t p u t f r e q u e n c y . t h e i e c 6 2 0 5 3 - 2 1 s p e c i f i c a t i o n s t a t e s t h a t t h e m e t e r m u s t s t a r t u p w i t h a l o a d e q u a l t o o r l e s s t h a n 0 . 4 % i p , w h i c h t r a n s l a t e s t o 0 . 0 1 6 7 % o f t h e f u l l - s c a l e o u t p u t f r e q u e n c y o f t h e m u l t i p l i e r .
a d e 7 5 1 8 r e v . 0 | p a g e 5 0 o f 1 2 8 a c t i v e e n e r g y c a l c u l a t i o n a s s t a t e d i n t h e a c t i v e p o w e r c a l c u l a t i o n s e c t i o n , p o w e r i s d e f i n e d a s t h e r a t e o f e n e r g y f l o w . t h i s r e l a t i o n s h i p c a n b e e x p r e s s e d m a t h e m a t i c a l l y i n e q u a t i o n 1 1 . d t d e p ( 1 1 ) w h e r e : p i s p o w e r . e i s e n e r g y . c o n v e r s e l y , e n e r g y i s g i v e n a s t h e i n t e g r a l o f p o w e r . 3 d t t p e ) ( ( 1 2 ) t h e a d e 7 5 1 8 a c h i e v e s t h e i n t e g r a t i o n o f t h e a c t i v e p o w e r s i g n a l b y c o n t i n u o u s l y a c c u m u l a t i n g t h e a c t i v e p o w e r s i g n a l i n a n i n t e r n a l , n o n r e a d a b l e , 4 9 - b i t e n e r g y r e g i s t e r . t h e a c t i v e e n e r g y r e g i s t e r ( w a t t h r [ 2 3 : 0 ] ) r e p r e s e n t s t h e u p p e r 2 4 b i t s o f t h i s i n t e r n a l r e g i s t e r . t h i s d i s c r e t e t i m e a c c u m u l a t i o n o r s u m m a t i o n i s e q u i v a l e n t t o i n t e g r a t i o n i n c o n t i n u o u s t i m e . e q u a t i o n 1 3 e x p r e s s e s t h e r e l a t i o n s h i p . ? ? ? ? - u | 3 f o 1 0 ) ( l i m ) ( n t t n t p d t t p e ( 1 3 ) w h e r e : n i s t h e d i s c r e t e t i m e s a m p l e n u m b e r . t i s t h e s a m p l e p e r i o d . t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i n t h e a d e 7 5 1 8 i s 1 . 2 2 s ( 5 / m c l k ) . i n a d d i t i o n t o c a l c u l a t i n g t h e e n e r g y , t h i s i n t e g r a t i o n r e m o v e s a n y s i n u s o i d a l c o m p o n e n t s t h a t m a y b e i n t h e a c t i v e p o w e r s i g n a l . f i g u r e 5 2 s h o w s t h i s d i s c r e t e t i m e i n t e g r a t i o n o r a c c u m u l a t i o n . t h e a c t i v e p o w e r s i g n a l i n t h e w a v e f o r m r e g i s t e r i s c o n t i n u o u s l y a d d e d t o t h e i n t e r n a l a c t i v e e n e r g y r e g i s t e r . t h e a c t i v e e n e r g y a c c u m u l a t i o n d e p e n d s o n t h e s e t t i n g o f t h e p o a m a n d a b s a m b i t s i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . w h e n b o t h b i t s a r e c l e a r e d , t h e a d d i t i o n i s s i g n e d a n d , t h e r e f o r e , n e g a t i v e e n e r g y i s s u b t r a c t e d f r o m t h e a c t i v e e n e r g y c o n t e n t s . w h e n b o t h b i t s a r e s e t , t h e a d e 7 5 1 8 i s s e t t o b e i n t h e m o r e r e s t r i c t i v e m o d e , t h e p o s i t i v e - o n l y a c c u m u l a t i o n m o d e . w h e n p o a m i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , o n l y p o s i - t i v e p o w e r c o n t r i b u t e s t o t h e a c t i v e e n e r g y a c c u m u l a t i o n . w h e n a b s a m i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , t h e a b s o l u t e a c t i v e p o w e r i s u s e d f o r t h e a c t i v e e n e r g y a c c u m u l a t i o n ( s e e t h e w a t t - a b s o l u t e a c c u m u l a t i o n m o d e s e c t i o n ) . t h e o u t p u t o f t h e m u l t i p l i e r i s d i v i d e d b y t h e v a l u e i n t h e w d i v r e g i s t e r . i f t h e v a l u e i n t h e w d i v r e g i s t e r i s e q u a l t o 0 , t h e i n t e r n a l a c t i v e e n e r g y r e g i s t e r i s d i v i d e d b y 1 . w d i v i s a n 8 - b i t u n s i g n e d r e g i s t e r . a f t e r d i v i d i n g b y w d i v , t h e a c t i v e e n e r g y i s a c c u m u l a t e d i n a 4 9 - b i t i n t e r n a l e n e r g y a c c u m u l a t i o n r e g i s t e r . t h e u p p e r 2 4 b i t s o f t h i s r e g i s t e r a r e a c c e s s i b l e t h r o u g h a r e a d t o t h e a c t i v e e n e r g y r e g i s t e r ( w a t t h r [ 2 3 : 0 ] ) . a r e a d t o t h e r w a t t h r r e g i s t e r r e t u r n s t h e c o n t e n t o f t h e w a t t h r r e g i s t e r , a n d t h e u p p e r 2 4 b i t s o f t h e i n t e r n a l r e g i s t e r a r e c l e a r e d . a s s h o w n i n f i g u r e 5 2 , t h e a c t i v e p o w e r s i g n a l i s a c c u m u l a t e d i n a n i n t e r n a l 4 9 - b i t s i g n e d r e g i s t e r . t h e a c t i v e p o w e r s i g n a l c a n b e r e a d f r o m t h e w a v e f o r m r e g i s t e r b y s e t t i n g t h e w a v m o d e r e g i s t e r ( 0 x 0 d ) a n d s e t t i n g t h e w f s m b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) . l i k e t h e c u r r e n t a n d v o l t a g e c h a n n e l s w a v e f o r m s a m p l i n g m o d e s , t h e w a v e f o r m d a t a i s a v a i l a b l e a t a s a m p l e r a t e o f 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s . w g a i n [ 1 1 : 0 ] w d i v [ 7 : 0 ] l p f 2 c u r r e n t c h a n n e l v o l t a g e c h a n n e l o u t p u t l p f 2 t i m e ( n t ) 5 m c l k t a c t i v e p o w e r s i g n a l + + w a t t h r [ 2 3 : 0 ] o u t p u t s f r o m t h e l p f 2 a r e a c c u m u l a t e d ( i n t e g r a t e d ) i n t h e i n t e r n a l a c t i v e e n e r g y r e g i s t e r u p p e r 2 4 b i t s a r e a c c e s s i b l e t h r o u g h w a t t h r [ 2 3 : 0 ] r e g i s t e r 2 3 0 4 8 0 % w a t t o s [ 1 5 : 0 ] 2 6 s g n 2 5 2 ? 6 2 ? 7 2 ? 8 + + f o r w a v e f o r m s a m p l i n g t o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r w a v e f o r m r e g i s t e r v a l u e s 0 7 3 2 7 - 0 5 2 f i g u r e 5 2 . a c t i v e e n e r g y c a l c u l a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 5 1 o f 1 2 8 f i g u r e 5 3 s h o w s t h i s e n e r g y a c c u m u l a t i o n f o r f u l l - s c a l e s i g n a l s ( s i n u s o i d a l ) o n t h e a n a l o g i n p u t s . t h e t h r e e d i s p l a y e d c u r v e s i l l u s t r a t e t h e m i n i m u m p e r i o d o f t i m e i t t a k e s t h e e n e r g y r e g i s t e r t o r o l l o v e r w h e n t h e a c t i v e p o w e r g a i n r e g i s t e r c o n t e n t s a r e 0 x 7 f f , 0 x 0 0 0 , a n d 0 x 8 0 0 . t h e w a t t g a i n r e g i s t e r i s u s e d t o c a r r y o u t p o w e r c a l i b r a t i o n i n t h e a d e 7 5 1 8 . a s s h o w n , t h e f a s t e s t i n t e g r a t i o n t i m e o c c u r s w h e n t h e w a t t g a i n r e g i s t e r i s s e t t o m a x i m u m f u l l s c a l e , t h a t i s , 0 x 7 f f . 0 x 0 0 , 0 0 0 0 0 x 7 f , f f f f 0 x 3 f , f f f f 0 x 4 0 , 0 0 0 0 0 x 8 0 , 0 0 0 0 w a t t h r [ 2 3 : 0 ] 6 . 8 2 3 . 4 1 1 0 . 2 1 3 . 7 t i m e ( m i n u t e s ) w g a i n = 0 x 7 f f w g a i n = 0 x 0 0 0 w g a i n = 0 x 8 0 0 0 7 3 2 7 - 0 5 3 f i g u r e 5 3 . e n e r g y r e g i s t e r r o l l o v e r t i m e f o r f u l l - s c a l e p o w e r ( m i n i m u m a n d m a x i m u m p o w e r g a i n ) n o t e t h a t t h e e n e r g y r e g i s t e r c o n t e n t s r o l l o v e r t o f u l l - s c a l e n e g a t i v e ( 0 x 8 0 0 0 0 0 ) a n d c o n t i n u e t o i n c r e a s e i n v a l u e w h e n t h e p o w e r o r e n e r g y f l o w i s p o s i t i v e ( s e e f i g u r e 5 3 ) . c o n v e r s e l y , i f t h e p o w e r i s n e g a t i v e , t h e e n e r g y r e g i s t e r u n d e r f l o w s t o f u l l - s c a l e p o s i t i v e ( 0 x 7 f f f f f ) a n d c o n t i n u e s t o d e c r e a s e i n v a l u e . b y u s i n g t h e i n t e r r u p t e n a b l e r e g i s t e r , t h e a d e 7 5 1 8 c a n b e c o n f i g u r e d t o i s s u e a n a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e w h e n t h e a c t i v e e n e r g y r e g i s t e r i s h a l f f u l l ( p o s i t i v e o r n e g a t i v e ) o r w h e n a n o v e r f l o w o r u n d e r f l o w o c c u r s . i n t e g r a t i o n t i m e u n d e r s t e a d y l o a d : a c t i v e e n e r g y a s m e n t i o n e d p r e v i o u s l y , t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i s 1 . 2 2 s ( 5 / m c l k ) . w i t h f u l l - s c a l e s i n u s o i d a l s i g n a l s o n t h e a n a l o g i n p u t s a n d t h e w g a i n r e g i s t e r s e t t o 0 x 0 0 0 , t h e a v e r a g e w o r d v a l u e f r o m e a c h l p f 2 i s 0 x c c c c d ( s e e f i g u r e 4 9 ) . t h e m a x i m u m p o s i t i v e v a l u e t h a t c a n b e s t o r e d i n t h e i n t e r n a l 4 9 - b i t r e g i s t e r i s 2 4 8 ( o r 0 x f f f f , f f f f , f f f f ) b e f o r e i t o v e r f l o w s . t h e i n t e g r a t i o n t i m e u n d e r t h e s e c o n d i t i o n s w h e n w d i v = 0 i s c a l c u l a t e d i n t h e f o l l o w i n g e q u a t i o n : t i m e = m i n 8 2 . 6 s e c 6 . 4 0 9  s 2 2 . 1 x c c c c d 0 f f f f f f f f , , x f f f f 0 u ( 1 4 ) w h e n w d i v i s s e t t o a v a l u e o t h e r t h a n 0 , t h e i n t e g r a t i o n t i m e v a r i e s , a s s h o w n i n e q u a t i o n 1 5 . t i m e = t i m e w d i v = 0 w d i v ( 1 5 ) a c t i v e e n e r g y a c c u m u l a t i o n m o d e s w a t t - s i g n e d a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 a c t i v e e n e r g y d e f a u l t a c c u m u l a t i o n m o d e i s a w a t t - s i g n e d a c c u m u l a t i o n b a s e d o n t h e a c t i v e p o w e r i n f o r m a t i o n . w a t t p o s i t i v e - o n l y a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 i s p l a c e d i n w a t t p o s i t i v e - o n l y a c c u m u l a t i o n m o d e b y s e t t i n g t h e p o a m b i t i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i n t h i s m o d e , t h e e n e r g y a c c u m u l a t i o n i s o n l y d o n e f o r p o s i t i v e p o w e r , i g n o r i n g a n y o c c u r r e n c e o f n e g a t i v e p o w e r a b o v e o r b e l o w t h e n o l o a d t h r e s h o l d ( s e e f i g u r e 5 4 ) . t h e c f p u l s e a l s o r e f l e c t s t h i s a c c u m u l a t i o n m e t h o d w h e n i n t h i s m o d e . t h e d e f a u l t s e t t i n g f o r t h i s m o d e i s o f f . d e t e c t i o n o f t h e t r a n s i t i o n s i n t h e d i r e c t i o n o f p o w e r f l o w a n d d e t e c t i o n o f n o l o a d t h r e s h o l d a r e a c t i v e i n t h i s m o d e . p o s p o s i n t e r r u p t s t a t u s r e g i s t e r s n e g a p s i g n f l a g n o l o a d t h r e s h o l d a c t i v e p o w e r n o l o a d t h r e s h o l d a c t i v e e n e r g y 0 7 3 2 7 - 0 5 4 f i g u r e 5 4 . e n e r g y a c c u m u l a t i o n i n p o s i t i v e - o n l y a c c u m u l a t i o n m o d e w a t t - a b s o l u t e a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 i s p l a c e d i n w a t t - a b s o l u t e a c c u m u l a t i o n m o d e b y s e t t i n g t h e a b s a m b i t i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i n t h i s m o d e , t h e e n e r g y a c c u m u l a t i o n i s d o n e u s i n g t h e a b s o l u t e a c t i v e p o w e r , i g n o r i n g a n y o c c u r r e n c e o f p o w e r b e l o w t h e n o l o a d t h r e s h o l d ( s e e f i g u r e 5 5 ) . t h e c f p u l s e a l s o r e f l e c t s t h i s a c c u m u l a t i o n m e t h o d w h e n i n t h i s m o d e . t h e d e f a u l t s e t t i n g f o r t h i s m o d e i s o f f . d e t e c t i o n o f t h e t r a n s i t i o n s i n t h e d i r e c t i o n o f p o w e r f l o w a n d d e t e c t i o n o f a n o l o a d t h r e s h o l d a r e a c t i v e i n t h i s m o d e .
a d e 7 5 1 8 r e v . 0 | p a g e 5 2 o f 1 2 8 p o s p o s i n t e r r u p t s t a t u s r e g i s t e r s n e g a p s i g n f l a g n o l o a d t h r e s h o l d a c t i v e p o w e r n o l o a d t h r e s h o l d a c t i v e e n e r g y a p n o l o a d a p n o l o a d 0 7 3 2 7 - 0 5 5 f i g u r e 5 5 . e n e r g y a c c u m u l a t i o n i n w a t t - a b s o l u t e a c c u m u l a t i o n m o d e a c t i v e e n e r g y p u l s e o u t p u t a l l o f t h e a d e 7 5 1 8 c i r c u i t r y h a s a p u l s e o u t p u t w h o s e f r e q u e n c y i s p r o p o r t i o n a l t o a c t i v e p o w e r ( s e e t h e a c t i v e p o w e r c a l c u l a t i o n s e c t i o n ) . t h i s p u l s e f r e q u e n c y o u t p u t u s e s t h e c a l i b r a t e d s i g n a l f r o m t h e w g a i n r e g i s t e r o u t p u t , a n d i t s b e h a v i o r i s c o n s i s t e n t w i t h t h e s e t t i n g o f t h e a c t i v e e n e r g y a c c u m u l a t i o n m o d e i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . t h e p u l s e o u t p u t i s a c t i v e l o w a n d s h o u l d b e p r e f e r a b l y c o n n e c t e d t o a n l e d , a s s h o w n i n f i g u r e 6 6 . l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n m o d e i n l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n m o d e , t h e e n e r g y a c c u m u l a t i o n o f t h e a d e 7 5 1 8 c a n b e s y n c h r o n i z e d t o t h e v o l t a g e c h a n n e l z e r o c r o s s i n g s o t h a t a c t i v e e n e r g y c a n b e a c c u m u l a t e d o v e r a n i n t e g e r n u m b e r o f h a l f - l i n e c y c l e s . t h e a d v a n t a g e o f s u m m i n g t h e a c t i v e e n e r g y o v e r a n i n t e g e r n u m b e r o f l i n e c y c l e s i s t h a t t h e s i n u s o i d a l c o m p o n e n t i n t h e a c t i v e e n e r g y i s r e d u c e d t o 0 . t h i s e l i m i n a t e s a n y r i p p l e i n t h e e n e r g y c a l c u l a t i o n . e n e r g y i s c a l c u l a t e d m o r e a c c u r a t e l y a n d m o r e q u i c k l y b e c a u s e t h e i n t e g r a t i o n p e r i o d c a n b e s h o r t e n e d . b y u s i n g t h i s m o d e , t h e e n e r g y c a l i b r a t i o n c a n b e g r e a t l y s i m p l i f i e d , a n d t h e t i m e r e q u i r e d t o c a l i b r a t e t h e m e t e r c a n b e s i g n i f i c a n t l y r e d u c e d . i n l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n m o d e , t h e a d e 7 5 1 8 a c c u m u l a t e s t h e a c t i v e p o w e r s i g n a l i n t h e l w a t t h r r e g i s t e r f o r a n i n t e g r a l n u m b e r o f l i n e c y c l e s , a s s h o w n i n f i g u r e 5 6 . t h e n u m b e r o f h a l f - l i n e c y c l e s i s s p e c i f i e d i n t h e l i n c y c r e g i s t e r . t h e a d e 7 5 1 8 c a n a c c u m u l a t e a c t i v e p o w e r f o r u p t o 6 5 , 5 3 5 h a l f - l i n e c y c l e s . b e c a u s e t h e a c t i v e p o w e r i s i n t e g r a t e d o n a n i n t e g e r n u m b e r o f l i n e c y c l e s , t h e c y c e n d f l a g i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) i s s e t a t t h e e n d o f a n a c t i v e e n e r g y a c c u m u l a t i o n l i n e c y c l e . i f t h e c y c e n d e n a b l e b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) i s s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e c y c e n d s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . a n o t h e r c a l i b r a t i o n c y c l e s t a r t s a s s o o n a s t h e c y c e n d f l a g i s s e t . i f t h e l w a t t h r r e g i s t e r i s n o t r e a d b e f o r e a n e w c y c e n d f l a g i s s e t , t h e l w a t t h r r e g i s t e r i s o v e r w r i t t e n b y a n e w v a l u e . w d i v [ 7 : 0 ] w a t t o s [ 1 5 : 0 ] w g a i n [ 1 1 : 0 ] l p f 1 + + l w a t t h r [ 2 3 : 0 ] a c t i v e e n e r g y i s a c c u m u l a t e d i n t h e i n t e r n a l r e g i s t e r , a n d t h e l w a t t h r r e g i s t e r i s u p d a t e d a t t h e e n d o f t h e l i n c y c h a l f - l i n e c y c l e s o u t p u t f r o m l p f 2 f r o m v o l t a g e c h a n n e l a d c 2 3 0 l i n c y c [ 1 5 : 0 ] 4 8 0 % z e r o - c r o s s i n g d e t e c t i o n c a l i b r a t i o n c o n t r o l t o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r 0 7 3 2 7 - 0 5 6 f i g u r e 5 6 . l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 5 3 o f 1 2 8 w h e n a n e w h a l f - l i n e c y c l e i s w r i t t e n i n t h e l i n c y c r e g i s t e r , t h e l w a t t h r r e g i s t e r i s r e s e t , a n d a n e w a c c u m u l a t i o n s t a r t s a t t h e n e x t z e r o c r o s s i n g . t h e n u m b e r o f h a l f - l i n e c y c l e s i s t h e n c o u n t e d u n t i l l i n c y c i s r e a c h e d . t h i s i m p l e m e n t a t i o n p r o v i d e s a v a l i d m e a s u r e m e n t a t t h e f i r s t c y c e n d i n t e r r u p t a f t e r w r i t i n g t o t h e l i n c y c r e g i s t e r ( s e e f i g u r e 5 7 ) . t h e l i n e a c t i v e e n e r g y a c c u m u l a t i o n u s e s t h e s a m e s i g n a l p a t h a s t h e a c t i v e e n e r g y a c c u m u l a t i o n . t h e l s b s i z e o f t h e s e t w o r e g i s t e r s i s e q u i v a l e n t . l i n c y c v a l u e c y c e n d i r q l w a t t h r r e g i s t e r 0 7 3 2 7 - 0 5 7 f i g u r e 5 7 . e n e r g y a c c u m u l a t i o n w h e n l i n c y c c h a n g e s f r o m t h e i n f o r m a t i o n i n e q u a t i o n 8 a n d e q u a t i o n 9 , d t f t f v i d t v i t e n t n t s ? ? ? ? - ?1 ?   3 3 2 c o s 9 . 8 1 0 2 0 ( 1 6 ) w h e r e : n i s a n i n t e g e r . t i s t h e l i n e c y c l e p e r i o d . b e c a u s e t h e s i n u s o i d a l c o m p o n e n t i s i n t e g r a t e d o v e r a n i n t e g e r n u m b e r o f l i n e c y c l e s , i t s v a l u e i s a l w a y s 0 . t h e r e f o r e , 0 0  3 n t v i d t e ( 1 7 ) e ( t ) = v i n t ( 1 8 ) n o t e t h a t i n t h i s m o d e , t h e 1 6 - b i t l i n c y c r e g i s t e r c a n h o l d a m a x i m u m v a l u e o f 6 5 , 5 3 5 . i n o t h e r w o r d s , t h e l i n e e n e r g y a c c u m u l a t i o n m o d e c a n b e u s e d t o a c c u m u l a t e a c t i v e e n e r g y f o r a m a x i m u m d u r a t i o n o f o v e r 6 5 , 5 3 5 h a l f - l i n e c y c l e s . a t a 6 0 h z l i n e f r e q u e n c y , t h i s t r a n s l a t e s t o a t o t a l d u r a t i o n o f 6 5 , 5 3 5 / 1 2 0 h z = 5 4 6 s e c . r e a c t i v e p o w e r c a l c u l a t i o n r e a c t i v e p o w e r i s d e f i n e d a s t h e p r o d u c t o f t h e v o l t a g e a n d c u r r e n t w a v e f o r m s w h e n o n e o f t h e s e s i g n a l s i s p h a s e - s h i f t e d b y 9 0 . t h e r e s u l t i n g w a v e f o r m i s c a l l e d t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l . e q u a t i o n 2 1 g i v e s a n e x p r e s s i o n f o r t h e i n s t a n t a - n e o u s r e a c t i v e p o w e r s i g n a l i n a n a c s y s t e m w h e n t h e p h a s e o f t h e c u r r e n t c h a n n e l i s s h i f t e d b y 9 0 . ) s i n ( 2 ) (  t v t v z ( 1 9 ) ) s i n ( 2 ) ( t i t i z ?1 ?  c 2 s i n 2 ) ( s z t i t i ( 2 0 ) w h e r e :  i s t h e p h a s e d i f f e r e n c e b e t w e e n t h e v o l t a g e a n d c u r r e n t c h a n n e l . v i s t h e r m s v o l t a g e . i i s t h e r m s c u r r e n t . q ( t ) = v ( t ) i ? ( t ) ( 2 1 ) q ( t ) = v i s i n (  ) + v i s i n ) 2 ( tz t t h e a v e r a g e r e a c t i v e p o w e r o v e r a n i n t e g e r n u m b e r o f l i n e s ( n ) i s g i v e n i n e q u a t i o n 2 2 . 3 t n t v i d t t q n t q 0 ) s i n ( ) ( 1 ( 2 2 ) w h e r e : t i s t h e l i n e c y c l e p e r i o d . q i s r e f e r r e d t o a s t h e r e a c t i v e p o w e r . n o t e t h a t t h e r e a c t i v e p o w e r i s e q u a l t o t h e d c c o m p o n e n t o f t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l q ( t ) i n e q u a t i o n 2 1 . t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l q ( t ) i s g e n e r a t e d b y m u l t i p l y i n g t h e v o l t a g e a n d c u r r e n t c h a n n e l s . i n t h i s c a s e , t h e p h a s e o f t h e c u r r e n t c h a n n e l i s s h i f t e d b y 9 0 . t h e d c c o m p o n e n t o f t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l i s t h e n e x t r a c t e d b y a l o w - p a s s f i l t e r t o o b t a i n t h e r e a c t i v e p o w e r i n f o r m a t i o n ( s e e f i g u r e 5 8 ) . i n a d d i t i o n , t h e p h a s e - s h i f t i n g f i l t e r h a s a n o n u n i t y m a g n i t u d e r e s p o n s e . b e c a u s e t h e p h a s e - s h i f t e d f i l t e r h a s a l a r g e a t t e n u a t i o n a t h i g h f r e q u e n c y , t h e r e a c t i v e p o w e r i s p r i m a r i l y f o r c a l c u l a t i o n a t l i n e f r e q u e n c y . t h e e f f e c t o f h a r m o n i c s i s l a r g e l y i g n o r e d i n t h e r e a c t i v e p o w e r c a l c u l a t i o n . n o t e t h a t , b e c a u s e o f t h e m a g n i t u d e c h a r a c t e r i s t i c o f t h e p h a s e s h i f t i n g f i l t e r , t h e w e i g h t o f t h e r e a c t i v e p o w e r i s s l i g h t l y d i f f e r e n t f r o m t h a t o f t h e a c t i v e p o w e r c a l c u l a t i o n ( s e e t h e e n e r g y r e g i s t e r s c a l i n g s e c t i o n ) . t h e f r e q u e n c y r e s p o n s e o f t h e l p f i n t h e r e a c t i v e s i g n a l p a t h i s i d e n t i c a l t o t h e o n e u s e d f o r l p f 2 i n t h e a v e r a g e a c t i v e p o w e r c a l c u l a t i o n . b e c a u s e l p f 2 d o e s n o t h a v e a n i d e a l b r i c k w a l l f r e q u e n c y r e s p o n s e ( s e e f i g u r e 5 1 ) , t h e r e a c t i v e p o w e r s i g n a l h a s s o m e r i p p l e d u e t o t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l . t h i s r i p p l e i s s i n u s o i d a l a n d h a s a f r e q u e n c y e q u a l t o t w i c e t h e l i n e f r e q u e n c y . b e c a u s e t h e r i p p l e i s s i n u s o i d a l i n n a t u r e , i t i s r e m o v e d w h e n t h e r e a c t i v e p o w e r s i g n a l i s i n t e g r a t e d t o c a l c u - l a t e e n e r g y . t h e r e a c t i v e p o w e r s i g n a l c a n b e r e a d f r o m t h e w a v e f o r m r e g i s t e r b y s e t t i n g t h e w a v m o d e r e g i s t e r ( 0 x 0 d ) a n d t h e w f s m b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) . l i k e t h e c u r r e n t a n d v o l t a g e c h a n n e l s w a v e f o r m s a m p l i n g m o d e s , t h e w a v e f o r m d a t a i s a v a i l a b l e a t a s a m p l e r a t e o f 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s .
a d e 7 5 1 8 r e v . 0 | p a g e 5 4 o f 1 2 8 r e a c t i v e p o w e r g a i n c a l i b r a t i o n f i g u r e 5 8 s h o w s t h e s i g n a l p r o c e s s i n g c h a i n f o r t h e a d e 7 5 1 8 r e a c t i v e p o w e r c a l c u l a t i o n . a s e x p l a i n e d i n t h e r e a c t i v e p o w e r c a l c u l a t i o n s e c t i o n , t h e r e a c t i v e p o w e r i s c a l c u l a t e d b y a p p l y i n g a l o w - p a s s f i l t e r t o t h e i n s t a n t a n e o u s r e a c t i v e p o w e r s i g n a l . n o t e t h a t , w h e n r e a d i n g t h e w a v e f o r m s a m p l e s f r o m t h e o u t p u t o f l p f 2 , t h e g a i n o f t h e r e a c t i v e e n e r g y c a n b e a d j u s t e d b y u s i n g t h e m u l t i p l i e r a n d b y w r i t i n g a t w o s c o m p l e m e n t , 1 2 - b i t w o r d t o t h e v a r g a i n r e g i s t e r ( v a r g a i n [ 1 1 : 0 ] ) . e q u a t i o n 2 3 s h o w s h o w t h e g a i n a d j u s t m e n t i s r e l a t e d t o t h e c o n t e n t s o f t h e w a t t g a i n r e g i s t e r . o u t p u t v a r g a i n = ?1 ? ? ? ? ? - u 1 2 2 1 v a r g a i n p o w e r r e a c t i v e ( 2 3 ) t h e r e s o l u t i o n o f t h e v a r g a i n r e g i s t e r i s t h e s a m e a s t h e w g a i n r e g i s t e r ( s e e t h e a c t i v e p o w e r g a i n c a l i b r a t i o n s e c t i o n ) . v a r g a i n c a n b e u s e d t o c a l i b r a t e t h e r e a c t i v e p o w e r ( o r e n e r g y ) c a l c u l a t i o n i n t h e a d e 7 5 1 8 . r e a c t i v e p o w e r o f f s e t c a l i b r a t i o n t h e a d e 7 5 1 8 a l s o i n c o r p o r a t e s a r e a c t i v e p o w e r o f f s e t r e g i s t e r ( v a r o s [ 1 5 : 0 ] ) . t h i s i s a s i g n e d , t w o s c o m p l e m e n t , 1 6 - b i t r e g i s t e r t h a t c a n b e u s e d t o r e m o v e o f f s e t s i n t h e r e a c t i v e p o w e r c a l c u l a t i o n ( s e e f i g u r e 5 8 ) . a n o f f s e t m a y e x i s t i n t h e r e a c t i v e p o w e r c a l c u l a - t i o n d u e t o c r o s s t a l k b e t w e e n c h a n n e l s o n t h e p c b o r i n t h e i c i t s e l f . t h e o f f s e t c a l i b r a t i o n a l l o w s t h e c o n t e n t s o f t h e r e a c t i v e p o w e r r e g i s t e r t o b e m a i n t a i n e d a t 0 w h e n n o p o w e r i s b e i n g c o n s u m e d . t h e 2 5 6 l s b s ( v a r o s = 0 x 1 0 0 ) w r i t t e n t o t h e r e a c t i v e p o w e r o f f s e t r e g i s t e r a r e e q u i v a l e n t t o 1 l s b i n t h e w a v m o d e r e g i s t e r . s i g n o f r e a c t i v e p o w e r c a l c u l a t i o n n o t e t h a t t h e a v e r a g e r e a c t i v e p o w e r i s a s i g n e d c a l c u l a t i o n . t h e p h a s e - s h i f t f i l t e r h a s ? 9 0 p h a s e s h i f t w h e n t h e i n t e g r a t o r i s e n a b l e d , a n d + 9 0 p h a s e s h i f t w h e n t h e i n t e g r a t o r i s d i s a b l e d . t a b l e 4 3 s u m m a r i z e s h o w t h e r e l a t i o n s h i p o f t h e p h a s e d i f f e r e n c e b e t w e e n t h e v o l t a g e a n d t h e c u r r e n t a f f e c t s t h e s i g n o f t h e r e s u l t i n g v a r c a l c u l a t i o n . t a b l e 4 3 . s i g n o f r e a c t i v e p o w e r c a l c u l a t i o n a n g l e i n t e g r a t o r s i g n b e t w e e n 0 t o + 9 0 o f f p o s i t i v e b e t w e e n ? 9 0 t o 0 o f f n e g a t i v e b e t w e e n 0 t o + 9 0 o n p o s i t i v e b e t w e e n ? 9 0 t o 0 o n n e g a t i v e r e a c t i v e p o w e r s i g n d e t e c t i o n t h e a d e 7 5 1 8 d e t e c t s a c h a n g e o f s i g n i n t h e r e a c t i v e p o w e r . t h e v a r s i g n f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) r e c o r d s w h e n a c h a n g e o f s i g n h a s o c c u r r e d a c c o r d i n g t o t h e v a r s i g n b i t i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i f t h e v a r s i g n b i t i s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e v a r s i g n s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . w h e n v a r s i g n i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s c l e a r e d ( d e f a u l t ) , t h e v a r s i g n f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t w h e n a t r a n s i t i o n f r o m p o s i t i v e t o n e g a t i v e r e a c t i v e p o w e r o c c u r s . i f v a r s i g n i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , t h e v a r s i g n f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t w h e n a t r a n s i t i o n f r o m n e g a t i v e t o p o s i t i v e r e a c t i v e p o w e r o c c u r s . r e a c t i v e p o w e r n o l o a d d e t e c t i o n t h e a d e 7 5 1 8 i n c l u d e s a n o l o a d t h r e s h o l d f e a t u r e o n t h e r e a c t i v e e n e r g y t h a t e l i m i n a t e s a n y c r e e p e f f e c t s i n t h e m e t e r . t h e a d e 7 5 1 8 a c c o m p l i s h e s t h i s b y n o t a c c u m u l a t i n g r e a c t i v e e n e r g y w h e n t h e m u l t i p l i e r o u t p u t i s b e l o w t h e n o l o a d t h r e s h o l d . w h e n t h e r e a c t i v e p o w e r i s b e l o w t h e n o l o a d t h r e s h o l d , t h e r n o l o a d f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t . i f t h e r n o l o a d b i t i s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e r n o l o a d s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . t h e n o l o a d t h r e s h o l d l e v e l i s s e l e c t a b l e b y s e t t i n g t h e v a r n o l o a d b i t s i n t h e n l m o d e r e g i s t e r ( 0 x 0 e ) . s e t t i n g t h e s e b i t s t o 0 b 0 0 d i s a b l e s t h e n o l o a d d e t e c t i o n , a n d s e t t i n g t h e m t o 0 b 0 1 , 0 b 1 0 , o r 0 b 1 1 s e t s t h e n o l o a d d e t e c t i o n t h r e s h o l d t o 0 . 0 1 5 % , 0 . 0 0 7 5 % , a n d 0 . 0 0 3 7 % o f t h e f u l l - s c a l e o u t p u t f r e q u e n c y o f t h e m u l t i p l i e r , r e s p e c t i v e l y . r e a c t i v e e n e r g y c a l c u l a t i o n a s f o r r e a c t i v e e n e r g y , t h e a d e 7 5 1 8 a c h i e v e s t h e i n t e g r a t i o n o f t h e r e a c t i v e p o w e r s i g n a l b y c o n t i n u o u s l y a c c u m u l a t i n g t h e r e a c t i v e p o w e r s i g n a l i n a n i n t e r n a l , n o n r e a d a b l e , 4 9 - b i t e n e r g y r e g i s t e r . t h e r e a c t i v e e n e r g y r e g i s t e r ( v a r h r [ 2 3 : 0 ] ) r e p r e s e n t s t h e u p p e r 2 4 b i t s o f t h i s i n t e r n a l r e g i s t e r . t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i n t h e a d e 7 5 1 8 i s 1 . 2 2 s ( 5 / m c l k ) . a s w e l l a s c a l c u l a t i n g t h e e n e r g y , t h i s i n t e g r a t i o n r e m o v e s a n y s i n u s o i d a l c o m p o n e n t s t h a t m a y b e i n t h e a c t i v e p o w e r s i g n a l . f i g u r e 5 8 s h o w s t h i s d i s c r e t e t i m e i n t e g r a t i o n o r a c c u m u l a t i o n . t h e r e a c t i v e p o w e r s i g n a l i n t h e w a v e f o r m r e g i s t e r i s c o n t i n u o u s l y a d d e d t o t h e i n t e r n a l r e a c t i v e e n e r g y r e g i s t e r . t h e r e a c t i v e e n e r g y a c c u m u l a t i o n d e p e n d s o n t h e s e t t i n g o f t h e s a v a r m a n d a b s v a r m b i t s i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . w h e n b o t h b i t s a r e c l e a r e d , t h e a d d i t i o n i s s i g n e d a n d , t h e r e f o r e , n e g a t i v e e n e r g y i s s u b t r a c t e d f r o m t h e r e a c t i v e e n e r g y c o n t e n t s . w h e n b o t h b i t s a r e s e t , t h e a d e 7 5 1 8 i s s e t t o b e i n t h e m o r e r e s t r i c t i v e m o d e , t h e a b s o l u t e a c c u m u l a t i o n m o d e .
a d e 7 5 1 8 r e v . 0 | p a g e 5 5 o f 1 2 8 w h e n s a v a r m i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , t h e r e a c t i v e p o w e r i s a c c u m u l a t e d d e p e n d i n g o n t h e s i g n o f t h e a c t i v e p o w e r . w h e n a c t i v e p o w e r i s p o s i t i v e , t h e r e a c t i v e p o w e r i s a d d e d a s i t i s t o t h e r e a c t i v e e n e r g y r e g i s t e r . w h e n a c t i v e p o w e r i s n e g a t i v e , t h e r e a c t i v e p o w e r i s s u b t r a c t e d f r o m t h e r e a c t i v e e n e r g y a c c u m u l a t o r ( s e e t h e v a r a n t i t a m p e r a c c u m u l a t i o n m o d e s e c t i o n ) . w h e n a b s v a r m i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) i s s e t , t h e a b s o l u t e r e a c t i v e p o w e r i s u s e d f o r t h e r e a c t i v e e n e r g y a c c u m u - l a t i o n ( s e e t h e v a r a b s o l u t e a c c u m u l a t i o n m o d e s e c t i o n ) . t h e o u t p u t o f t h e m u l t i p l i e r i s d i v i d e d b y v a r d i v . i f t h e v a l u e i n t h e v a r d i v r e g i s t e r i s e q u a l t o 0 , t h e i n t e r n a l r e a c t i v e e n e r g y r e g i s t e r i s d i v i d e d b y 1 . v a r d i v i s a n 8 - b i t , u n s i g n e d r e g i s t e r . a f t e r d i v i d i n g b y v a r d i v , t h e r e a c t i v e e n e r g y i s a c c u m u l a t e d i n a 4 9 - b i t i n t e r n a l e n e r g y a c c u m u l a t i o n r e g i s t e r . t h e u p p e r 2 4 b i t s o f t h i s r e g i s t e r a r e a c c e s s i b l e t h r o u g h a r e a d t o t h e r e a c t i v e e n e r g y r e g i s t e r ( v a r h r [ 2 3 : 0 ] ) . a r e a d t o t h e r v a r h r r e g i s t e r r e t u r n s t h e c o n t e n t o f t h e v a r h r r e g i s t e r , a n d t h e u p p e r 2 4 b i t s o f t h e i n t e r n a l r e g i s t e r a r e c l e a r e d . a s s h o w n i n f i g u r e 5 8 , t h e r e a c t i v e p o w e r s i g n a l i s a c c u m u l a t e d i n a n i n t e r n a l 4 9 - b i t s i g n e d r e g i s t e r . t h e r e a c t i v e p o w e r s i g n a l c a n b e r e a d f r o m t h e w a v e f o r m r e g i s t e r b y s e t t i n g t h e w a v m o d e r e g i s t e r ( 0 x 0 d ) a n d s e t t i n g t h e w f s m b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) . l i k e t h e c u r r e n t a n d v o l t a g e c h a n n e l w a v e f o r m s a m p l i n g m o d e s , t h e w a v e f o r m d a t a i s a v a i l a b l e a t a s a m p l e r a t e o f 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s . f i g u r e 5 3 s h o w s t h i s e n e r g y a c c u m u l a t i o n f o r f u l l - s c a l e s i g n a l s ( s i n u s o i d a l ) o n t h e a n a l o g i n p u t s . t h e s e c u r v e s a l s o a p p l y f o r t h e r e a c t i v e e n e r g y a c c u m u l a t i o n . n o t e t h a t t h e e n e r g y r e g i s t e r c o n t e n t s r o l l o v e r t o f u l l - s c a l e n e g a t i v e ( 0 x 8 0 0 0 0 0 ) a n d c o n t i n u e t o i n c r e a s e i n v a l u e w h e n t h e p o w e r o r e n e r g y f l o w i s p o s i t i v e . c o n v e r s e l y , i f t h e p o w e r i s n e g a t i v e , t h e r e a c t i v e e n e r g y r e g i s t e r u n d e r f l o w s t o f u l l - s c a l e p o s i t i v e ( 0 x 7 f f f f f ) a n d c o n t i n u e s t o d e c r e a s e i n v a l u e . b y u s i n g t h e i n t e r r u p t e n a b l e r e g i s t e r , t h e a d e 7 5 1 8 c a n b e c o n f i g u r e d t o i s s u e a n a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e w h e n t h e r e a c t i v e e n e r g y r e g i s t e r i s h a l f f u l l ( p o s i t i v e o r n e g a t i v e ) o r w h e n a n o v e r f l o w o r u n d e r f l o w o c c u r s . v a r g a i n [ 1 1 : 0 ] v a r d i v [ 7 : 0 ] l p f 2 c u r r e n t c h a n n e l v o l t a g e c h a n n e l o u t p u t l p f 2 t i m e ( n t ) 5 m c l k t r e a c t i v e p o w e r s i g n a l + + v a r h r [ 2 3 : 0 ] u p p e r 2 4 b i t s a r e a c c e s s i b l e t h r o u g h v a r h r [ 2 3 : 0 ] r e g i s t e r 2 3 0 4 8 0 w a v e f o r m r e g i s t e r v a l u e s % v a r o s [ 1 5 : 0 ] 2 6 s g n 2 5 2 ? 6 2 ? 7 2 ? 8 + + f o r w a v e f o r m s a m p l i n g h p f 3 2 p h c a l [ 7 : 0 ] 9 0 p h a s e s h i f t i n g f i l t e r o u t p u t s f r o m t h e l p f 2 a r e a c c u m u l a t e d ( i n t e g r a t e d ) i n t h e i n t e r n a l r e a c t i v e e n e r g y r e g i s t e r t o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r 0 7 3 2 7 - 0 5 8 f i g u r e 5 8 . r e a c t i v e e n e r g y c a l c u l a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 5 6 o f 1 2 8 i n t e g r a t i o n t i m e u n d e r s t e a d y l o a d : r e a c t i v e e n e r g y a s m e n t i o n e d i n t h e a c t i v e e n e r g y c a l c u l a t i o n s e c t i o n , t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i s 1 . 2 2 s ( 5 / m c l k ) . w i t h f u l l - s c a l e s i n u s o i d a l s i g n a l s o n t h e a n a l o g i n p u t s a n d t h e v a r g a i n a n d v a r d i v r e g i s t e r s s e t t o 0 x 0 0 0 , t h e i n t e g r a t i o n t i m e b e f o r e t h e r e a c t i v e e n e r g y r e g i s t e r o v e r f l o w s i s c a l c u l a t e d i n e q u a t i o n 2 4 . t i m e = m i n 8 2 . 6 s e c 6 . 4 0 9 s 2 2 . 1 0 x c c c c d f f f f f f f f , 0 x f f f f , pu ( 2 4 ) w h e n v a r d i v i s s e t t o a v a l u e o t h e r t h a n 0 , t h e i n t e g r a t i o n t i m e v a r i e s , a s s h o w n i n e q u a t i o n 2 5 . v a r d i v t i m e t i m e w d i v u 0 ( 2 5 ) r e a c t i v e e n e r g y a c c u m u l a t i o n m o d e s v a r - s i g n e d a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 r e a c t i v e e n e r g y d e f a u l t a c c u m u l a t i o n m o d e i s a s i g n e d a c c u m u l a t i o n b a s e d o n t h e r e a c t i v e p o w e r i n f o r m a t i o n . v a r a n t i t a m p e r a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 i s p l a c e d i n v a r a n t i t a m p e r a c c u m u l a t i o n m o d e b y s e t t i n g t h e s a v a r m b i t i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i n t h i s m o d e , t h e r e a c t i v e p o w e r i s a c c u m u l a t e d d e p e n d i n g o n t h e s i g n o f t h e a c t i v e p o w e r . w h e n a c t i v e p o w e r i s p o s i t i v e , t h e r e a c t i v e p o w e r i s a d d e d a s i t i s t o t h e r e a c t i v e e n e r g y r e g i s t e r . w h e n a c t i v e p o w e r i s n e g a t i v e , t h e r e a c t i v e p o w e r i s s u b t r a c t e d f r o m t h e r e a c t i v e e n e r g y a c c u m u l a t o r ( s e e f i g u r e 5 9 ) . t h e c f p u l s e a l s o r e f l e c t s t h i s a c c u m u l a t i o n m e t h o d w h e n i n t h i s m o d e . t h e d e f a u l t s e t t i n g f o r t h i s m o d e i s o f f . t r a n s i t i o n s i n t h e d i r e c t i o n o f p o w e r f l o w a n d n o l o a d t h r e s h o l d a r e a c t i v e i n t h i s m o d e . p o s p o s i n t e r r u p t s t a t u s r e g i s t e r s n e g a p s i g n f l a g a c t i v e p o w e r n o l o a d t h r e s h o l d n o l o a d t h r e s h o l d r e a c t i v e e n e r g y n o l o a d t h r e s h o l d r e a c t i v e p o w e r n o l o a d t h r e s h o l d 0 7 3 2 7 - 0 5 9 f i g u r e 5 9 . r e a c t i v e e n e r g y a c c u m u l a t i o n i n a n t i t a m p e r a c c u m u l a t i o n m o d e
a d e 7 5 1 8 r e v . 0 | p a g e 5 7 o f 1 2 8 v a r a b s o l u t e a c c u m u l a t i o n m o d e t h e a d e 7 5 1 8 i s p l a c e d i n a b s o l u t e a c c u m u l a t i o n m o d e b y s e t t i n g t h e a b s v a r m b i t i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . i n a b s o l u t e a c c u m u l a t i o n m o d e , t h e r e a c t i v e e n e r g y a c c u m u l a t i o n i s d o n e b y u s i n g t h e a b s o l u t e r e a c t i v e p o w e r a n d i g n o r i n g a n y o c c u r r e n c e o f p o w e r b e l o w t h e n o l o a d t h r e s h o l d f o r t h e a c t i v e e n e r g y ( s e e f i g u r e 6 0 ) . t h e c f p u l s e a l s o r e f l e c t s t h i s a c c u m u l a - t i o n m e t h o d w h e n i n a b s o l u t e a c c u m u l a t i o n m o d e . t h e d e f a u l t s e t t i n g f o r t h i s m o d e i s o f f . t r a n s i t i o n s i n t h e d i r e c t i o n o f p o w e r f l o w a n d n o l o a d t h r e s h o l d a r e a c t i v e i n t h i s m o d e . r e a c t i v e e n e r g y n o l o a d t h r e s h o l d n o l o a d t h r e s h o l d r e a c t i v e p o w e r 0 7 3 2 7 - 0 6 0 f i g u r e 6 0 . r e a c t i v e e n e r g y a c c u m u l a t i o n i n a b s o l u t e a c c u m u l a t i o n m o d e r e a c t i v e e n e r g y p u l s e o u t p u t t h e a d e 7 5 1 8 p r o v i d e s a l l t h e c i r c u i t r y w i t h a p u l s e o u t p u t w h o s e f r e q u e n c y i s p r o p o r t i o n a l t o r e a c t i v e p o w e r ( s e e t h e e n e r g y - t o - f r e q u e n c y c o n v e r s i o n s e c t i o n ) . t h i s p u l s e f r e - q u e n c y o u t p u t u s e s t h e c a l i b r a t e d s i g n a l a f t e r v a r g a i n , a n d i t s b e h a v i o r i s c o n s i s t e n t w i t h t h e s e t t i n g o f t h e r e a c t i v e e n e r g y a c c u m u l a t i o n m o d e i n t h e a c c m o d e r e g i s t e r ( 0 x 0 f ) . t h e p u l s e o u t p u t i s a c t i v e l o w a n d s h o u l d p r e f e r a b l y b e c o n n e c t e d t o a n l e d , a s s h o w n i n f i g u r e 6 6 . l i n e c y c l e r e a c t i v e e n e r g y a c c u m u l a t i o n m o d e i n l i n e c y c l e r e a c t i v e e n e r g y a c c u m u l a t i o n m o d e , t h e e n e r g y a c c u m u l a t i o n o f t h e a d e 7 5 1 8 c a n b e s y n c h r o n i z e d t o t h e v o l t a g e c h a n n e l z e r o c r o s s i n g s o t h a t r e a c t i v e e n e r g y c a n b e a c c u m u l a t e d o v e r a n i n t e g e r n u m b e r o f h a l f - l i n e c y c l e s . t h e a d v a n t a g e o f t h i s m o d e i s s i m i l a r t o t h a t d e s c r i b e d i n t h e l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n m o d e s e c t i o n . i n l i n e c y c l e a c t i v e e n e r g y a c c u m u l a t i o n m o d e , t h e a d e 7 5 1 8 a c c u m u l a t e s t h e r e a c t i v e p o w e r s i g n a l i n t h e l v a r h r r e g i s t e r f o r a n i n t e g r a l n u m b e r o f l i n e c y c l e s , a s s h o w n i n f i g u r e 6 1 . t h e n u m b e r o f h a l f - l i n e c y c l e s i s s p e c i f i e d i n t h e l i n c y c r e g i s t e r . t h e a d e 7 5 1 8 c a n a c c u m u l a t e a c t i v e p o w e r f o r u p t o 6 5 , 5 3 5 h a l f - l i n e c y c l e s . b e c a u s e t h e r e a c t i v e p o w e r i s i n t e g r a t e d o n a n i n t e g e r n u m b e r o f l i n e c y c l e s , t h e c y c e n d f l a g i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) i s s e t a t t h e e n d o f a n a c t i v e e n e r g y a c c u m u l a - t i o n l i n e c y c l e . i f t h e c y c e n d e n a b l e b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) i s s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e c y c e n d s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . a n o t h e r c a l i b r a t i o n c y c l e s t a r t s a s s o o n a s t h e c y c e n d f l a g i s s e t . i f t h e l v a r h r r e g i s t e r i s n o t r e a d b e f o r e a n e w c y c e n d f l a g i s s e t , t h e l v a r h r r e g i s t e r i s o v e r w r i t t e n b y a n e w v a l u e . w h e n a n e w h a l f - l i n e c y c l e i s w r i t t e n i n t h e l i n c y c r e g i s t e r , t h e l v a r h r r e g i s t e r i s r e s e t , a n d a n e w a c c u m u l a t i o n s t a r t s a t t h e n e x t z e r o c r o s s i n g . t h e n u m b e r o f h a l f - l i n e c y c l e s i s t h e n c o u n t e d u n t i l l i n c y c i s r e a c h e d . t h i s i m p l e m e n t a t i o n p r o v i d e s a v a l i d m e a s u r e m e n t a t t h e f i r s t c y c e n d i n t e r r u p t a f t e r w r i t i n g t o t h e l i n c y c r e g i s t e r . t h e l i n e r e a c t i v e e n e r g y a c c u m u l a t i o n u s e s t h e s a m e s i g n a l p a t h a s t h e r e a c t i v e e n e r g y a c c u m u l a t i o n . t h e l s b s i z e o f t h e s e t w o r e g i s t e r s i s e q u i v a l e n t . l p f 1 + + o u t p u t f r o m l p f 2 f r o m v o l t a g e c h a n n e l a d c 2 3 0 l i n c y c [ 1 5 : 0 ] 4 8 0 % z e r o - c r o s s i n g d e t e c t i o n l v a r h r [ 2 3 : 0 ] c a l i b r a t i o n c o n t r o l v a r d i v [ 7 : 0 ] v a r o s [ 1 5 : 0 ] v a r g a i n [ 1 1 : 0 ] t o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r r e a c t i v e e n e r g y i s a c c u m u l a t e d i n t h e i n t e r n a l r e g i s t e r , a n d t h e l w a t t h r r e g i s t e r i s u p d a t e d a t t h e e n d o f t h e l i n c y c h a l f - l i n e c y c l e s 0 7 3 2 7 - 0 6 1 f i g u r e 6 1 . l i n e c y c l e r e a c t i v e e n e r g y a c c u m u l a t i o n m o d e
a d e 7 5 1 8 r e v . 0 | p a g e 5 8 o f 1 2 8 a p p a r e n t p o w e r c a l c u l a t i o n a p p a r e n t p o w e r i s d e f i n e d a s t h e m a x i m u m p o w e r t h a t c a n b e d e l i v e r e d t o a l o a d . v r m s a n d i r m s a r e t h e e f f e c t i v e v o l t a g e a n d c u r r e n t d e l i v e r e d t o t h e l o a d , r e s p e c t i v e l y . t h e r e f o r e , t h e a p p a r e n t p o w e r ( a p ) = v r m s i r m s . t h i s e q u a t i o n i s i n d e p e n d e n t f r o m t h e p h a s e a n g l e b e t w e e n t h e c u r r e n t a n d t h e v o l t a g e . e q u a t i o n 2 9 g i v e s a n e x p r e s s i o n o f t h e i n s t a n t a n e o u s p o w e r s i g n a l i n a n a c s y s t e m w i t h a p h a s e s h i f t . ( ) 2 s i n ( ) r m s v t v t z ( 2 6 ) ) s i n ( 2 tz t i t i r m s ( 2 7 ) ) ( ) ( ) ( t i t v t p u ( 2 8 ) ) 2 c o s ( ) c o s ( tz t t i v i v t p r m s r m s r m s r m s ( 2 9 ) f i g u r e 6 2 i l l u s t r a t e s t h e s i g n a l p r o c e s s i n g f o r t h e c a l c u l a t i o n o f t h e a p p a r e n t p o w e r i n t h e a d e 7 5 1 8 . t h e a p p a r e n t p o w e r s i g n a l c a n b e r e a d f r o m t h e w a v e f o r m r e g i s t e r b y s e t t i n g t h e w a v m o d e r e g i s t e r ( 0 x 0 d ) a n d s e t t i n g t h e w f s m b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) . l i k e t h e c u r r e n t a n d v o l t a g e c h a n n e l w a v e f o r m s a m p l i n g m o d e s , t h e w a v e f o r m d a t a i s a v a i l a b l e a t a s a m p l e r a t e o f 2 5 . 6 k s p s , 1 2 . 8 k s p s , 6 . 4 k s p s , o r 3 . 2 k s p s . t h e g a i n o f t h e a p p a r e n t e n e r g y c a n b e a d j u s t e d b y u s i n g t h e m u l t i p l i e r a n d b y w r i t i n g a t w o s c o m p l e m e n t , 1 2 - b i t w o r d t o t h e v a g a i n r e g i s t e r ( v a g a i n [ 1 1 : 0 ] ) . e q u a t i o n 3 0 s h o w s h o w t h e g a i n a d j u s t m e n t i s r e l a t e d t o t h e c o n t e n t s o f t h e v a g a i n r e g i s t e r . o u t p u t v a g a i n = ?1 ? ? ? ? ? - u 1 2 2 1 v a g a i n p o w e r a p p a r e n t ( 3 0 ) f o r e x a m p l e , w h e n 0 x 7 f f i s w r i t t e n t o t h e v a g a i n r e g i s t e r , t h e p o w e r o u t p u t i s s c a l e d u p b y 5 0 % ( 0 x 7 f f = 2 0 4 7 d , 2 0 4 7 / 2 1 2 = 0 . 5 ) . s i m i l a r l y , 0 x 8 0 0 = ? 2 0 4 7 d ( s i g n e d t w o s c o m p l e m e n t ) a n d p o w e r o u t p u t i s s c a l e d b y ? 5 0 % . e a c h l s b r e p r e s e n t s 0 . 0 2 4 4 % o f t h e p o w e r o u t p u t . t h e a p p a r e n t p o w e r i s c a l c u l a t e d w i t h t h e c u r r e n t a n d v o l t a g e r m s v a l u e s o b t a i n e d i n t h e r m s b l o c k s o f t h e a d e 7 5 1 8 . a p p a r e n t p o w e r o f f s e t c a l i b r a t i o n e a c h r m s m e a s u r e m e n t i n c l u d e s a n o f f s e t c o m p e n s a t i o n r e g i s t e r t o c a l i b r a t e a n d e l i m i n a t e t h e d c c o m p o n e n t i n t h e r m s v a l u e ( s e e t h e c u r r e n t c h a n n e l r m s c a l c u l a t i o n s e c t i o n a n d t h e v o l t a g e c h a n n e l r m s c a l c u l a t i o n s e c t i o n ) . t h e v o l t a g e a n d c u r r e n t c h a n n e l s r m s v a l u e s a r e t h e n m u l t i p l i e d t o g e t h e r i n t h e a p p a r - e n t p o w e r s i g n a l p r o c e s s i n g . b e c a u s e n o a d d i t i o n a l o f f s e t s a r e c r e a t e d i n t h e m u l t i p l i c a t i o n o f t h e r m s v a l u e s , t h e r e i s n o s p e c i f i c o f f s e t c o m p e n s a t i o n i n t h e a p p a r e n t p o w e r s i g n a l p r o c e s s i n g . t h e o f f s e t c o m p e n s a t i o n o f t h e a p p a r e n t p o w e r m e a s u r e m e n t i s d o n e b y c a l i b r a t i n g e a c h i n d i v i d u a l r m s m e a s u r e m e n t . v r m s i r m s 0 x 1 a 3 6 e 2 a p p a r e n t p o w e r s i g n a l ( p ) c u r r e n t r m s s i g n a l ? i ( t ) v o l t a g e r m s s i g n a l ? v ( t ) 0 x 0 0 0 x 1 c f 6 8 c 0 x 0 0 0 x 1 c f 6 8 c v a g a i n t o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r v a r m s c f c o n 0 7 3 2 7 - 0 6 2 f i g u r e 6 2 . a p p a r e n t p o w e r s i g n a l p r o c e s s i n g
a d e 7 5 1 8 r e v . 0 | p a g e 5 9 o f 1 2 8 a p p a r e n t e n e r g y c a l c u l a t i o n t h e a p p a r e n t e n e r g y i s g i v e n a s t h e i n t e g e r o f t h e a p p a r e n t p o w e r . 3 d t t p o w e r a p p a r e n t e n e r g y a p p a r e n t ) ( ( 3 1 ) t h e a d e 7 5 1 8 a c h i e v e s t h e i n t e g r a t i o n o f t h e a p p a r e n t p o w e r s i g n a l b y c o n t i n u o u s l y a c c u m u l a t i n g t h e a p p a r e n t p o w e r s i g n a l i n a n i n t e r n a l 4 8 - b i t r e g i s t e r . t h e a p p a r e n t e n e r g y r e g i s t e r ( v a h r [ 2 3 : 0 ] ) r e p r e s e n t s t h e u p p e r 2 4 b i t s o f t h i s i n t e r n a l r e g i s t e r . t h i s d i s c r e t e t i m e a c c u m u l a t i o n o r s u m m a t i o n i s e q u i v a l e n t t o i n t e g r a t i o n i n c o n t i n u o u s t i m e . e q u a t i o n 3 2 e x p r e s s e s t h e r e l a t i o n s h i p . ? ? ? ? - u | f o 0 0 ) ( l i m n t t n t p o w e r a p p a r e n t e n e r g y a p p a r e n t ( 3 2 ) w h e r e : n i s t h e d i s c r e t e t i m e s a m p l e n u m b e r . t i s t h e s a m p l e p e r i o d . t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i n t h e a d e 7 5 1 8 i s 1 . 2 2 s ( 5 / m c l k ) . f i g u r e 6 3 s h o w s t h i s d i s c r e t e t i m e i n t e g r a t i o n o r a c c u m u l a t i o n . t h e a p p a r e n t p o w e r s i g n a l i s c o n t i n u o u s l y a d d e d t o t h e i n t e r n a l r e g i s t e r . t h i s a d d i t i o n i s a s i g n e d a d d i t i o n e v e n i f t h e a p p a r e n t e n e r g y t h e o r e t i c a l l y r e m a i n s p o s i t i v e . t h e 4 9 b i t s o f t h e i n t e r n a l r e g i s t e r a r e d i v i d e d b y v a d i v . i f t h e v a l u e i n t h e v a d i v r e g i s t e r i s 0 , t h e i n t e r n a l a p p a r e n t e n e r g y r e g i s t e r i s d i v i d e d b y 1 . v a d i v i s a n 8 - b i t u n s i g n e d r e g i s t e r . t h e u p p e r 2 4 b i t s a r e t h e n w r i t t e n i n t h e 2 4 - b i t a p p a r e n t e n e r g y r e g i s t e r ( v a h r [ 2 3 : 0 ] ) . t h e r v a h r r e g i s t e r ( 2 4 b i t s l o n g ) i s p r o v i d e d t o r e a d t h e a p p a r e n t e n e r g y . t h i s r e g i s t e r i s r e s e t t o 0 a f t e r a r e a d o p e r a t i o n . n o t e t h a t t h e a p p a r e n t e n e r g y r e g i s t e r i s u n s i g n e d . b y s e t t i n g t h e v a e h f a n d v a e o f b i t s i n t h e i n t e r r u p t e n a b l e 2 s f r ( m i r q e n m , 0 x d a ) , t h e a d e 7 5 1 8 c a n b e c o n f i g u r e d t o i s s u e a n a d e i n t e r r u p t t o t h e 8 0 5 2 c o r e w h e n t h e a p p a r e n t e n e r g y r e g i s t e r i s h a l f - f u l l o r w h e n a n o v e r f l o w o c c u r s . t h e h a l f - f u l l i n t e r r u p t f o r t h e u n s i g n e d a p p a r e n t e n e r g y r e g i s t e r i s b a s e d o n 2 4 b i t s a s o p p o s e d t o 2 3 b i t s f o r t h e s i g n e d a c t i v e e n e r g y r e g i s t e r . i n t e g r a t i o n t i m e s u n d e r s t e a d y l o a d : a p p a r e n t e n e r g y a s m e n t i o n e d i n t h e a p p a r e n t e n e r g y c a l c u l a t i o n s e c t i o n , t h e d i s c r e t e t i m e s a m p l e p e r i o d ( t ) f o r t h e a c c u m u l a t i o n r e g i s t e r i s 1 . 2 2 s ( 5 / m c l k ) . w i t h f u l l - s c a l e s i n u s o i d a l s i g n a l s o n t h e a n a l o g i n p u t s a n d t h e v a g a i n r e g i s t e r s e t t o 0 x 0 0 0 , t h e a v e r a g e w o r d v a l u e f r o m t h e a p p a r e n t p o w e r s t a g e i s 0 x 1 a 3 6 e 2 ( s e e t h e a p p a r e n t p o w e r c a l c u l a t i o n s e c t i o n ) . t h e m a x i m u m v a l u e t h a t c a n b e s t o r e d i n t h e a p p a r e n t e n e r g y r e g i s t e r b e f o r e i t o v e r f l o w s i s 2 2 4 o r 0 x f f , f f f f . t h e a v e r a g e w o r d v a l u e i s a d d e d t o t h e i n t e r n a l r e g i s t e r , w h i c h c a n s t o r e 2 4 8 o r 0 x f f f f , f f f f , f f f f b e f o r e i t o v e r f l o w s . t h e r e f o r e , t h e i n t e g r a t i o n t i m e u n d e r t h e s e c o n d i t i o n s w i t h v a d i v = 0 i s c a l c u l a t e d a s f o l l o w s : t i m e = m i n 3 3 . 3 s e c 1 9 9 s 2 2 . 1 0 x d 0 5 5 f f f f f f f f , 0 x f f f f , pu ( 3 3 ) w h e n v a d i v i s s e t t o a v a l u e o t h e r t h a n 0 , t h e i n t e g r a t i o n t i m e v a r i e s , a s s h o w n i n e q u a t i o n 3 4 . t i m e = t i m e w d i v = 0 v a d i v ( 3 4 ) v a d i v a p p a r e n t p o w e r o r i r m s + + v a h r [ 2 3 : 0 ] a p p a r e n t p o w e r o r i r m s i s a c c u m u l a t e d ( i n t e g r a t e d ) i n t h e a p p a r e n t e n e r g y r e g i s t e r 2 3 0 4 8 0 4 8 0 % t i m e ( n t ) t a p p a r e n t p o w e r s i g n a l = p 0 7 3 2 7 - 0 6 3 f i g u r e 6 3 . a p p a r e n t e n e r g y c a l c u l a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 6 0 o f 1 2 8 a p p a r e n t e n e r g y p u l s e o u t p u t a l l a d e 7 5 1 8 c i r c u i t r y h a s a p u l s e o u t p u t w h o s e f r e q u e n c y i s p r o p o r t i o n a l t o a p p a r e n t p o w e r ( s e e t h e e n e r g y - t o - f r e q u e n c y c o n v e r s i o n s e c t i o n ) . t h i s p u l s e f r e q u e n c y o u t p u t u s e s t h e c a l i b r a t e d s i g n a l a f t e r v a g a i n . t h i s o u t p u t c a n a l s o b e u s e d t o o u t p u t a p u l s e w h o s e f r e q u e n c y i s p r o p o r t i o n a l t o i r m s . t h e p u l s e o u t p u t i s a c t i v e l o w a n d s h o u l d p r e f e r a b l y b e c o n n e c t e d t o a n l e d , a s s h o w n i n f i g u r e 6 6 . l i n e a p p a r e n t e n e r g y a c c u m u l a t i o n t h e a d e 7 5 1 8 i s d e s i g n e d w i t h a s p e c i a l a p p a r e n t e n e r g y a c c u m u l a t i o n m o d e t h a t s i m p l i f i e s t h e c a l i b r a t i o n p r o c e s s . b y u s i n g t h e o n - c h i p z e r o - c r o s s i n g d e t e c t i o n , t h e a d e 7 5 1 8 a c c u m u l a t e s t h e a p p a r e n t p o w e r s i g n a l i n t h e l v a h r r e g i s t e r f o r a n i n t e g r a l n u m b e r o f h a l f c y c l e s , a s s h o w n i n f i g u r e 6 4 . l i n e a p p a r e n t e n e r g y a c c u m u l a t i o n m o d e i s a l w a y s a c t i v e . t h e n u m b e r o f h a l f - l i n e c y c l e s i s s p e c i f i e d i n t h e l i n c y c r e g i s - t e r , w h i c h i s a n u n s i g n e d 1 6 - b i t r e g i s t e r . t h e a d e 7 5 1 8 c a n a c c u m u l a t e a p p a r e n t p o w e r f o r u p t o 6 5 , 5 3 5 c o m b i n e d h a l f c y c l e s . b e c a u s e t h e a p p a r e n t p o w e r i s i n t e g r a t e d o n t h e s a m e i n t e g r a l n u m b e r o f l i n e c y c l e s a s t h e l i n e a c t i v e r e g i s t e r a n d r e a c t i v e e n e r g y r e g i s t e r , t h e s e v a l u e s c a n e a s i l y b e c o m p a r e d . t h e e n e r g i e s a r e c a l c u l a t e d m o r e a c c u r a t e l y b e c a u s e o f t h i s p r e c i s e t i m i n g c o n t r o l , a n d p r o v i d e a l l t h e i n f o r m a t i o n n e e d e d f o r r e a c t i v e p o w e r a n d p o w e r f a c t o r c a l c u l a t i o n . a t t h e e n d o f a n e n e r g y c a l i b r a t i o n c y c l e , t h e c y c e n d f l a g i n t h e i n t e r r u p t s t a t u s 3 s f r ( m i r q s t h , 0 x d e ) i s s e t . i f t h e c y c e n d e n a b l e b i t i n t h e i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) i s e n a b l e d , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . a s f o r l w a t t h r , w h e n a n e w h a l f - l i n e c y c l e i s w r i t t e n i n t h e l i n c y c r e g i s t e r , t h e l v a h r r e g i s t e r i s r e s e t a n d a n e w a c c u m u l a t i o n s t a r t s a t t h e n e x t z e r o c r o s s i n g . t h e n u m b e r o f h a l f - l i n e c y c l e s i s t h e n c o u n t e d u n t i l l i n c y c i s r e a c h e d . t h i s i m p l e m e n t a t i o n p r o v i d e s a v a l i d m e a s u r e m e n t a t t h e f i r s t c y c e n d i n t e r r u p t a f t e r w r i t i n g t o t h e l i n c y c r e g i s t e r . t h e l i n e a p p a r e n t e n e r g y a c c u m u l a t i o n u s e s t h e s a m e s i g n a l p a t h a s t h e a p p a r e n t e n e r g y a c c u m u l a t i o n . t h e l s b s i z e o f t h e s e t w o r e g i s t e r s i s e q u i v a l e n t . a p p a r e n t p o w e r n o l o a d d e t e c t i o n t h e a d e 7 5 1 8 i n c l u d e s a n o l o a d t h r e s h o l d f e a t u r e o n t h e a p p a r e n t p o w e r t h a t e l i m i n a t e s a n y c r e e p e f f e c t s i n t h e m e t e r . t h e a d e 7 5 1 8 a c c o m p l i s h e s t h i s b y n o t a c c u m u l a t i n g e n e r g y i f t h e m u l t i p l i e r o u t p u t i s b e l o w t h e n o l o a d t h r e s h o l d . w h e n t h e a p p a r e n t p o w e r i s b e l o w t h e n o l o a d t h r e s h o l d , t h e v a n o l o a d f l a g i n t h e i n t e r r u p t s t a t u s 1 s f r ( m i r q s t l , 0 x d c ) i s s e t . i f t h e v a n o l o a d b i t i s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e a p n o l o a d s t a t u s b i t i s c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . t h e n o l o a d t h r e s h o l d l e v e l i s s e l e c t a b l e b y s e t t i n g t h e v a n o l o a d b i t s i n t h e n l m o d e r e g i s t e r ( 0 x 0 e ) . s e t t i n g t h e s e b i t s t o 0 b 0 0 d i s a b l e s t h e n o l o a d d e t e c t i o n , a n d s e t t i n g t h e m t o 0 b 0 1 , 0 b 1 0 , o r 0 b 1 1 s e t s t h e n o l o a d d e t e c t i o n t h r e s h o l d t o 0 . 0 3 0 % , 0 . 0 1 5 % , a n d 0 . 0 0 7 5 % o f t h e f u l l - s c a l e o u t p u t f r e - q u e n c y o f t h e m u l t i p l i e r , r e s p e c t i v e l y . t h i s n o l o a d t h r e s h o l d c a n a l s o b e a p p l i e d t o t h e i r m s p u l s e o u t p u t w h e n s e l e c t e d . i n t h i s c a s e , t h e l e v e l o f n o l o a d t h r e s h o l d i s t h e s a m e a s f o r t h e a p p a r e n t e n e r g y . a m p e r e - h o u r a c c u m u l a t i o n i n a t a m p e r i n g s i t u a t i o n w h e r e n o v o l t a g e i s a v a i l a b l e t o t h e e n e r g y m e t e r , t h e a d e 7 5 1 8 i s c a p a b l e o f a c c u m u l a t i n g t h e a m p e r e - h o u r i n s t e a d o f a p p a r e n t p o w e r i n t o v a h r , r v a h r , a n d l v a h r . w h e n b i t 3 ( v a r m s c f c o n ) o f t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) i s s e t , v a h r , r v a h r , l v a h r , a n d t h e i n p u t f o r t h e d i g i t a l - t o - f r e q u e n c y c o n v e r t e r a c c u m u l a t e i r m s i n s t e a d o f a p p a r e n t p o w e r . a l l t h e s i g n a l p r o c e s s i n g a n d c a l i b r a t i o n r e g i s t e r s a v a i l a b l e f o r a p p a r e n t p o w e r a n d e n e r g y a c c u m u l a t i o n r e m a i n t h e s a m e w h e n a m p e r e - h o u r a c c u m u l a t i o n i s s e l e c t e d . h o w e v e r , t h e s c a l i n g d i f f e r e n c e b e t w e e n i r m s a n d a p p a r e n t p o w e r r e q u i r e s i n d e p e n d e n t v a l u e s f o r g a i n c a l i b r a t i o n i n t h e v a g a i n , v a d i v , c f x n u m , a n d c f x d e n r e g i s t e r s . l p f 1 + + l v a h r [ 2 3 : 0 ] l v a h r r e g i s t e r i s u p d a t e d e v e r y l i n c y c z e r o c r o s s i n g w i t h t h e t o t a l a p p a r e n t e n e r g y d u r i n g t h a t d u r a t i o n f r o m v o l t a g e c h a n n e l a d c 2 3 0 l i n c y c [ 1 5 : 0 ] 4 8 0 % z e r o - c r o s s i n g d e t e c t i o n c a l i b r a t i o n c o n t r o l v a d i v [ 7 : 0 ] a p p a r e n t p o w e r o r i r m s 0 7 3 2 7 - 0 6 4 f i g u r e 6 4 . l i n e c y c l e a p p a r e n t e n e r g y a c c u m u l a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 6 1 o f 1 2 8 e n e r g y - t o - f r e q u e n c y c o n v e r s i o n t h e a d e 7 5 1 8 a l s o p r o v i d e s t w o e n e r g y - t o - f r e q u e n c y c o n v e r s i o n s f o r c a l i b r a t i o n p u r p o s e s . a f t e r i n i t i a l c a l i b r a t i o n a t m a n u f a c t u r i n g , t h e m a n u f a c t u r e r o r e n d c u s t o m e r o f t e n v e r i f i e s t h e e n e r g y m e t e r c a l i b r a t i o n . o n e c o n v e n i e n t w a y t o d o t h i s i s f o r t h e m a n u f a c t u r e r t o p r o v i d e a n o u t p u t f r e q u e n c y t h a t i s p r o p o r - t i o n a l t o t h e a c t i v e p o w e r , r e a c t i v e p o w e r , a p p a r e n t p o w e r , o r i r m s u n d e r s t e a d y l o a d c o n d i t i o n s . t h i s o u t p u t f r e q u e n c y c a n p r o v i d e a s i m p l e , s i n g l e - w i r e , o p t i c a l l y i s o l a t e d i n t e r f a c e t o e x t e r n a l c a l i b r a t i o n e q u i p m e n t . f i g u r e 6 5 i l l u s t r a t e s t h e e n e r g y - t o - f r e q u e n c y c o n v e r s i o n i n t h e a d e 7 5 1 8 . v a r v a c f x s e l [ 1 : 0 ] w a t t v a r m s c f c o n m o d e 2 r e g i s t e r 0 x 0 c i r m s c f x p u l s e o u t p u t c f x n u m c f x d e n d f c 0 7 3 2 7 - 0 6 5 f i g u r e 6 5 . e n e r g y - t o - f r e q u e n c y c o n v e r s i o n t w o d i g i t a l - t o - f r e q u e n c y c o n v e r t e r s ( d f c ) a r e u s e d t o g e n e r a t e t h e p u l s e d o u t p u t s . w h e n w d i v = 0 o r 1 , t h e d f c g e n e r a t e s a p u l s e e a c h t i m e 1 l s b i n t h e e n e r g y r e g i s t e r i s a c c u m u l a t e d . a n o u t p u t p u l s e i s g e n e r a t e d w h e n a c f x n u m / c f x d e n n u m b e r o f p u l s e s a r e g e n e r a t e d a t t h e d f c o u t p u t . u n d e r s t e a d y l o a d c o n d i t i o n s , t h e o u t p u t f r e q u e n c y i s p r o p o r t i o n a l t o t h e a c t i v e p o w e r , r e a c t i v e p o w e r , a p p a r e n t p o w e r , o r i r m s , d e p e n d i n g o n t h e c f x s e l b i t s i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . b o t h p u l s e o u t p u t s c a n b e e n a b l e d o r d i s a b l e d b y c l e a r i n g o r s e t t i n g b i t d i s c f 1 a n d b i t d i s c f 2 i n t h e m o d e 1 r e g i s t e r ( 0 x 0 b ) , r e s p e c t i v e l y . b o t h p u l s e o u t p u t s s e t s e p a r a t e f l a g s i n t h e i n t e r r u p t s t a t u s 2 s f r ( m i r q s t m , 0 x d d ) , c f 1 a n d c f 2 . i f t h e c f 1 a n d c f 2 e n a b l e b i t s i n t h e i n t e r r u p t e n a b l e 2 s f r ( m i r q e n m , 0 x d a ) a r e s e t , t h e 8 0 5 2 c o r e h a s a p e n d i n g a d e i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e c f 1 o r c f 2 s t a t u s b i t s a r e c l e a r e d ( s e e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s s e c t i o n ) . p u l s e o u t p u t c o n f i g u r a t i o n t h e t w o p u l s e o u t p u t c i r c u i t s h a v e s e p a r a t e c o n f i g u r a t i o n b i t s i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . s e t t i n g t h e c f x s e l b i t s t o 0 b 0 0 , 0 b 0 1 , o r 0 b 1 x c o n f i g u r e s t h e d f c t o c r e a t e a p u l s e o u t p u t p r o p o r t i o n a l t o a c t i v e p o w e r , t o r e a c t i v e p o w e r , o r t o a p p a r e n t p o w e r o r i r m s , r e s p e c t i v e l y . t h e s e l e c t i o n b e t w e e n i r m s a n d a p p a r e n t p o w e r i s d o n e b y t h e v a r m s c f c o n b i t i n t h e m o d e 2 r e g i s t e r ( 0 x 0 c ) . w i t h t h i s s e l e c t i o n , c f 2 c a n n o t b e p r o p o r t i o n a l t o a p p a r e n t p o w e r i f c f 1 i s p r o p o r t i o n a l t o i r m s , a n d c f 1 c a n n o t b e p r o p o r t i o n a l t o a p p a r e n t p o w e r i f c f 2 i s p r o p o r t i o n a l t o i r m s . p u l s e o u t p u t c h a r a c t e r i s t i c t h e p u l s e o u t p u t f o r b o t h d f c s s t a y s l o w f o r 9 0 m s i f t h e p u l s e p e r i o d i s l o n g e r t h a n 1 8 0 m s ( 5 . 5 6 h z ) . i f t h e p u l s e p e r i o d i s s h o r t e r t h a n 1 8 0 m s , t h e d u t y c y c l e o f t h e p u l s e o u t p u t i s 5 0 % . t h e p u l s e o u t p u t i s a c t i v e l o w a n d s h o u l d p r e f e r a b l y b e c o n n e c t e d t o a n l e d , a s s h o w n i n f i g u r e 6 6 . v d d c f 0 7 3 2 7 - 0 6 6 f i g u r e 6 6 . c f p u l s e o u t p u t t h e m a x i m u m o u t p u t f r e q u e n c y w i t h a c i n p u t s i g n a l s a t f u l l s c a l e a n d c f x n u m = 0 x 0 0 a n d c f x d e n = 0 x 0 0 i s a p p r o x i m a t e l y 2 1 . 1 k h z . t h e a d e 7 5 1 8 i n c o r p o r a t e s t w o r e g i s t e r s p e r d f c , c f x n u m [ 1 5 : 0 ] a n d c f x d e n [ 1 5 : 0 ] , t o s e t t h e c f x f r e q u e n c y . t h e s e a r e u n s i g n e d 1 6 - b i t r e g i s t e r s t h a t c a n b e u s e d t o a d j u s t t h e c f x f r e q u e n c y t o a w i d e r a n g e o f v a l u e s . t h e s e f r e q u e n c y s c a l i n g r e g i s t e r s a r e 1 6 - b i t r e g i s t e r s t h a t c a n s c a l e t h e o u t p u t f r e q u e n c y b y 1 / 2 1 6 t o 1 w i t h a s t e p o f 1 / 2 1 6 . i f 0 i s w r i t t e n t o a n y o f t h e s e r e g i s t e r s , 1 i s a p p l i e d t o t h e r e g i s - t e r . t h e r a t i o c f x n u m / c f x d e n s h o u l d b e l e s s t h a n 1 t o e n s u r e p r o p e r o p e r a t i o n . i f t h e r a t i o o f t h e c f x n u m / c f x d e n r e g i s t e r s i s g r e a t e r t h a n 1 , t h e r e g i s t e r v a l u e s a r e a d j u s t e d t o a r a t i o o f 1 . f o r e x a m p l e , i f t h e o u t p u t f r e q u e n c y i s 1 . 5 6 2 k h z a n d t h e c o n t e n t o f c f x d e n i s 0 ( 0 x 0 0 0 ) , t h e o u t p u t f r e q u e n c y c a n b e s e t t o 6 . 1 h z b y w r i t i n g 0 x f f t o t h e c f x d e n r e g i s t e r .
a d e 7 5 1 8 r e v . 0 | p a g e 6 2 o f 1 2 8 e n e r g y r e g i s t e r s c a l i n g t h e a d e 7 5 1 8 p r o v i d e s m e a s u r e m e n t s o f a c t i v e , r e a c t i v e , a n d a p p a r e n t e n e r g i e s t h a t u s e s e p a r a t e p a t h s a n d f i l t e r i n g f o r c a l c u l a - t i o n . t h e d i f f e r e n c e i n d a t a p a t h s m a y r e s u l t i n s m a l l d i f f e r e n c e s i n l s b w e i g h t b e t w e e n a c t i v e , r e a c t i v e , a n d a p p a r e n t e n e r g y r e g i s t e r s . t h e s e m e a s u r e m e n t s a r e i n t e r n a l l y c o m p e n s a t e d s o t h a t t h e s c a l i n g i s n e a r l y o n e t o o n e . t h e r e l a t i o n s h i p b e t w e e n t h e s e r e g i s t e r s i s s h o w n i n t a b l e 4 4 . t a b l e 4 4 . e n e r g y r e g i s t e r s s c a l i n g l i n e f r e q u e n c y = 5 0 h z l i n e f r e q u e n c y = 6 0 h z i n t e g r a t o r v a r = 0 . 9 9 5 2 w a t t v a r = 0 . 9 9 4 9 w a t t o f f v a = 0 . 9 9 7 8 w a t t v a = 1 . 0 0 1 5 w a t t o f f v a r = 0 . 9 9 9 7 w a t t v a r = 0 . 9 9 9 9 w a t t o n v a = 0 . 9 9 7 7 w a t t v a = 1 . 0 0 1 5 w a t t o n e n e r g y m e a s u r e m e n t i n t e r r u p t s t h e e n e r g y m e a s u r e m e n t p a r t o f t h e a d e 7 5 1 8 h a s i t s o w n i n t e r r u p t v e c t o r f o r t h e 8 0 5 2 c o r e , v e c t o r a d d r e s s 0 x 0 0 4 b ( s e e t h e i n t e r r u p t v e c t o r s s e c t i o n ) . t h e b i t s s e t i n t h e i n t e r r u p t e n a b l e 1 s f r ( m i r q e n l , 0 x d 9 ) , i n t e r r u p t e n a b l e 2 s f r ( m i r q e n m , 0 x d a ) , a n d i n t e r r u p t e n a b l e 3 s f r ( m i r q e n h , 0 x d b ) e n a b l e t h e e n e r g y m e a s u r e m e n t i n t e r r u p t s t h a t a r e a l l o w e d t o i n t e r r u p t t h e 8 0 5 2 c o r e . i f a n e v e n t i s n o t e n a b l e d , i t c a n n o t c r e a t e a s y s t e m i n t e r r u p t . t h e a d e i n t e r r u p t s t a y s a c t i v e u n t i l t h e s t a t u s b i t t h a t h a s c r e a t e d t h e i n t e r r u p t i s c l e a r e d . t h e s t a t u s b i t i s c l e a r e d w h e n a z e r o i s w r i t t e n t o t h i s r e g i s t e r b i t .
a d e 7 5 1 8 r e v . 0 | p a g e 6 3 o f 1 2 8 8 0 5 2 m c u c o r e a r c h i t e c t u r e t h e a d e 7 5 1 8 h a s a n 8 0 5 2 m c u c o r e a n d u s e s t h e 8 0 5 1 i n s t r u c - t i o n s e t . s o m e o f t h e s t a n d a r d 8 0 5 2 p e r i p h e r a l s , s u c h a s t h e u a r t , h a v e b e e n e n h a n c e d . t h i s s e c t i o n d e s c r i b e s t h e s t a n d a r d 8 0 5 2 c o r e a n d i t s e n h a n c e m e n t s u s e d i n t h e a d e 7 5 1 8 . t h e s p e c i a l f u n c t i o n r e g i s t e r ( s f r ) s p a c e i s m a p p e d i n t o t h e u p p e r 1 2 8 b y t e s o f i n t e r n a l d a t a m e m o r y s p a c e a n d i s a c c e s s e d b y d i r e c t a d d r e s s i n g o n l y . i t p r o v i d e s a n i n t e r f a c e b e t w e e n t h e c p u a n d a l l o n - c h i p p e r i p h e r a l s . a b l o c k d i a g r a m s h o w i n g t h e p r o g r a m m i n g m o d e l o f t h e a d e 7 5 1 8 v i a t h e s f r a r e a i s s h o w n i n f i g u r e 6 7 . a l l r e g i s t e r s e x c e p t t h e p r o g r a m c o u n t e r ( p c ) , t h e i n s t r u c t i o n r e g i s t e r ( i r ) , a n d t h e f o u r g e n e r a l - p u r p o s e r e g i s t e r b a n k s r e s i d e i n t h e s f r a r e a . t h e s f r r e g i s t e r s i n c l u d e p o w e r c o n t r o l , c o n f i g u r a t i o n , a n d d a t a r e g i s t e r s t h a t p r o v i d e a n i n t e r f a c e b e t w e e n t h e c p u a n d a l l o n - c h i p p e r i p h e r a l s . e n e r g y m e a s u r e m e n t p c 1 6 k b e l e c t r i c a l l y r e p r o g r a m m a b l e n o n v o l a t i l e f l a s h / e e p r o g r a m / d a t a m e m o r y 8 0 5 1 - c o m p a t i b l e c o r e 2 5 6 b y t e s x r a m o t h e r o n - c h i p p e r i p h e r a l s : ? s e r i a l i / o ? w d t ? t i m e r s b a t t e r y a d c l c d d r i v e r r t c p o w e r m a n a g e m e n t 1 2 8 - b y t e s p e c i a l f u n c t i o n r e g i s t e r a r e a i r s t a c k 2 5 6 b y t e s g e n e r a l - p u r p o s e r a m r e g i s t e r b a n k s 0 7 3 2 7 - 0 6 7 f i g u r e 6 7 . b l o c k d i a g r a m m c u r e g i s t e r s t h e r e g i s t e r s u s e d b y t h e m c u a r e s u m m a r i z e d i n t h i s s e c t i o n . t a b l e 4 5 . 8 0 5 2 s f r s a d d r e s s m n e m o n i c b i t a d d r e s s a b l e d e s c r i p t i o n 0 x e 0 a c c y e s a c c u m u l a t o r . 0 x f 0 b y e s a u x i l i a r y m a t h . 0 x d 0 p s w y e s p r o g r a m s t a t u s w o r d ( s e e t a b l e 4 6 ) . 0 x 8 7 p c o n n o p r o g r a m c o n t r o l ( s e e t a b l e 4 7 ) . 0 x 8 2 d p l n o d a t a p o i n t e r l o w ( s e e t a b l e 4 8 ) . 0 x 8 3 d p h n o d a t a p o i n t e r h i g h ( s e e t a b l e 4 9 ) . 0 x 8 3 a n d 0 x 8 2 d p t r n o d a t a p o i n t e r ( s e e t a b l e 5 0 ) . 0 x 8 1 s p n o s t a c k p o i n t e r ( s e e t a b l e 5 1 ) . 0 x a f c f g n o c o n f i g u r a t i o n ( s e e t a b l e 5 2 ) . t a b l e 4 6 . p r o g r a m s t a t u s w o r d s f r ( p s w , 0 x d 0 ) b i t a d d r e s s m n e m o n i c d e s c r i p t i o n 7 0 x d 7 c y c a r r y f l a g . m o d i f i e d b y a d d , a d d c , s u b b , m u l , a n d d i v i n s t r u c t i o n s . 6 0 x d 6 a c a u x i l i a r y c a r r y f l a g . m o d i f i e d b y a d d a n d a d d c i n s t r u c t i o n s . 5 0 x d 5 f 0 g e n e r a l - p u r p o s e f l a g a v a i l a b l e t o t h e u s e r . 4 t o 3 0 x d 4 , 0 x d 3 r s 1 , r s 0 r e g i s t e r b a n k s e l e c t b i t s . r s 1 r s 0 r e s u l t ( s e l e c t e d b a n k ) 0 0 0 0 1 1 1 0 2 1 1 3 2 0 x d 2 o v o v e r f l o w f l a g . m o d i f i e d b y a d d , a d d c , s u b b , m u l , a n d d i v i n s t r u c t i o n s . 1 0 x d 1 f 1 g e n e r a l - p u r p o s e f l a g a v a i l a b l e t o t h e u s e r . 0 0 x d 0 p p a r i t y b i t . t h e n u m b e r o f b i t s s e t i n t h e a c c u m u l a t o r a d d e d t o t h e v a l u e o f t h e p a r i t y b i t i s a l w a y s a n e v e n n u m b e r .
a d e 7 5 1 8 r e v . 0 | p a g e 6 4 o f 1 2 8 t a b l e 4 7 . p r o g r a m c o n t r o l s f r ( p c o n , 0 x 8 7 ) b i t d e f a u l t d e s c r i p t i o n 7 0 s m o d b i t . d o u b l e b a u d r a t e c o n t r o l . 6 t o 0 0 r e s e r v e d . s h o u l d b e l e f t c l e a r e d . t a b l e 4 8 . d a t a p o i n t e r l o w s f r ( d p l , 0 x 8 2 ) b i t d e f a u l t d e s c r i p t i o n 7 t o 0 0 c o n t a i n t h e l o w b y t e o f t h e d a t a p o i n t e r . t a b l e 4 9 . d a t a p o i n t e r h i g h s f r ( d p h , 0 x 8 3 ) b i t d e f a u l t d e s c r i p t i o n 7 t o 0 0 c o n t a i n t h e h i g h b y t e o f t h e d a t a p o i n t e r . t a b l e 5 0 . d a t a p o i n t e r s f r ( d p t r , 0 x 8 2 a n d 0 x 8 3 ) b i t d e f a u l t d e s c r i p t i o n 1 5 t o 0 0 c o n t a i n t h e 2 - b y t e a d d r e s s o f t h e d a t a p o i n t e r . d p t r i s a c o m b i n a t i o n o f d p h a n d d p l s f r s . t a b l e 5 1 . s t a c k p o i n t e r s f r ( s p , 0 x 8 1 ) b i t d e f a u l t d e s c r i p t i o n 7 t o 0 7 c o n t a i n t h e e i g h t l s b s o f t h e p o i n t e r f o r t h e s t a c k . t a b l e 5 2 . c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) b i t m n e m o n i c d e s c r i p t i o n 7 r e s e r v e d t h i s b i t s h o u l d b e l e f t s e t f o r p r o p e r o p e r a t i o n . 6 e x t e n e n h a n c e d u a r t e n a b l e b i t . e x t e n r e s u l t 0 s t a n d a r d 8 0 5 2 u a r t w i t h o u t e n h a n c e d e r r o r - c h e c k i n g f e a t u r e s . 1 e n h a n c e d u a r t w i t h e n h a n c e d e r r o r c h e c k i n g ( s e e t h e u a r t a d d i t i o n a l f e a t u r e s s e c t i o n ) . 5 s c p s s y n c h r o n o u s c o m m u n i c a t i o n s e l e c t i o n b i t . s c p s r e s u l t 0 i 2 c p o r t i s s e l e c t e d f o r c o n t r o l o f t h e s h a r e d i 2 c / s p i p i n s ( m o s i , m i s o , s c l k , a n d s s ) a n d s f r s . 1 s p i p o r t i s s e l e c t e d f o r c o n t r o l o f t h e s h a r e d i 2 c / s p i p i n s ( m o s i , m i s o , s c l k , a n d s s ) a n d s f r s . 4 m o d 3 8 e n 3 8 k h z m o d u l a t i o n e n a b l e b i t . m o d 3 8 e n r e s u l t 0 3 8 k h z m o d u l a t i o n i s d i s a b l e d . 1 3 8 k h z m o d u l a t i o n i s e n a b l e d o n t h e p i n s s e l e c t e d b y t h e m o d 3 8 [ 7 : 0 ] b i t s i n t h e e x t e n d e d p o r t c o n f i g u r a t i o n s f r ( e p c f g , 0 x 9 f ) . 3 t o 2 r e s e r v e d 1 t o 0 x r e n 1 , x r e n 0 x r e n x r e s u l t x r e n 1 o r x r e n 0 = 1 e n a b l e s m o v x i n s t r u c t i o n t o u s e 2 5 6 b y t e s o f e x t e n d e d r a m . x r e n 1 a n d x r e n 0 = 0 d i s a b l e s m o v x i n s t r u c t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 6 5 o f 1 2 8 b a s i c 8 0 5 2 r e g i s t e r s p r o g r a m c o u n t e r ( p c ) t h e p r o g r a m c o u n t e r h o l d s t h e 2 - b y t e a d d r e s s o f t h e n e x t i n s t r u c - t i o n t o b e f e t c h e d . t h e p c i s i n i t i a l i z e d w i t h 0 x 0 0 a t r e s e t a n d i s i n c r e m e n t e d a f t e r e a c h i n s t r u c t i o n i s p e r f o r m e d . n o t e t h a t t h e a m o u n t a d d e d t o t h e p c d e p e n d s o n t h e n u m b e r o f b y t e s i n t h e i n s t r u c t i o n , s o t h e i n c r e m e n t c a n r a n g e f r o m o n e b y t e t o t h r e e b y t e s . t h e p r o g r a m c o u n t e r i s n o t d i r e c t l y a c c e s s i b l e t o t h e u s e r b u t c a n b e d i r e c t l y m o d i f i e d b y c a l l a n d j m p i n s t r u c t i o n s t h a t c h a n g e w h i c h p a r t o f t h e p r o g r a m i s a c t i v e . i n s t r u c t i o n r e g i s t e r ( i r ) t h e i n s t r u c t i o n r e g i s t e r h o l d s t h e o p e r a t i o n s c o d e o f t h e i n s t r u c t i o n b e i n g e x e c u t e d . t h e o p e r a t i o n s c o d e i s t h e b i n a r y c o d e t h a t r e s u l t s f r o m a s s e m b l i n g a n i n s t r u c t i o n . t h i s r e g i s t e r i s n o t d i r e c t l y a c c e s s i b l e t o t h e u s e r . r e g i s t e r b a n k s t h e r e a r e f o u r b a n k s t h a t e a c h c o n t a i n s e i g h t b y t e - w i d e r e g i s t e r s f o r a t o t a l o f 3 2 b y t e s o f r e g i s t e r s . t h e s e r e g i s t e r s a r e c o n v e n i e n t f o r t e m p o r a r y s t o r a g e o f m a t h e m a t i c a l o p e r a n d s . a n i n s t r u c t i o n i n v o l v i n g t h e a c c u m u l a t o r a n d a r e g i s t e r c a n b e e x e c u t e d i n o n e c l o c k c y c l e , a s o p p o s e d t o t w o c l o c k c y c l e s , t o p e r f o r m a n i n s t r u c t i o n i n v o l v i n g t h e a c c u m u l a t o r a n d a l i t e r a l o r a b y t e o f g e n e r a l - p u r p o s e r a m . t h e r e g i s t e r b a n k s a r e l o c a t e d i n t h e f i r s t 3 2 b y t e s o f r a m . t h e a c t i v e r e g i s t e r b a n k i s s e l e c t e d b y t h e r s 0 a n d r s 1 b i t s i n t h e p r o g r a m s t a t u s w o r d s f r ( p s w , 0 x d 0 ) . a c c u m u l a t o r t h e a c c u m u l a t o r i s a w o r k i n g r e g i s t e r , s t o r i n g t h e r e s u l t s o f m a n y a r i t h m e t i c o r l o g i c a l o p e r a t i o n s . t h e a c c u m u l a t o r i s u s e d i n m o r e t h a n h a l f o f t h e 8 0 5 2 i n s t r u c t i o n s , w h e r e i t i s u s u a l l y r e f e r r e d t o a s ? a . ? t h e p r o g r a m s t a t u s r e g i s t e r ( p s w ) c o n s t a n t l y m o n i t o r s t h e n u m b e r o f b i t s t h a t a r e s e t i n t h e a c c u m u l a t o r t o d e t e r m i n e i f i t h a s e v e n o r o d d p a r i t y . t h e a c c u m u l a t o r i s s t o r e d i n t h e s f r s p a c e ( s e e t a b l e 4 5 ) . b r e g i s t e r t h e b r e g i s t e r i s u s e d b y t h e m u l t i p l y a n d d i v i d e i n s t r u c t i o n s , m u l a b a n d d i v a b , t o h o l d o n e o f t h e o p e r a n d s . b e c a u s e t h e b r e g i s t e r i s n o t u s e d f o r m a n y i n s t r u c t i o n s , i t c a n b e u s e d a s a s c r a t c h p a d r e g i s t e r , s u c h a s t h o s e i n t h e r e g i s t e r b a n k s . t h e b r e g i s t e r i s s t o r e d i n t h e s f r s p a c e ( s e e t a b l e 4 5 ) . p r o g r a m s t a t u s w o r d ( p s w ) t h e p s w r e g i s t e r r e f l e c t s t h e s t a t u s o f a r i t h m e t i c a n d l o g i c a l o p e r a t i o n s t h r o u g h c a r r y , a u x i l i a r y c a r r y , a n d o v e r f l o w f l a g s . t h e p a r i t y f l a g r e f l e c t s t h e p a r i t y o f t h e a c c u m u l a t o r c o n t e n t s , w h i c h c a n b e h e l p f u l f o r c o m m u n i c a t i o n p r o t o c o l s . t h e p s w b i t s a r e d e s c r i b e d i n t a b l e 4 6 . t h e p r o g r a m s t a t u s w o r d s f r ( p s w , 0 x d 0 ) i s b i t a d d r e s s a b l e . d a t a p o i n t e r ( d p t r ) t h e d a t a p o i n t e r i s m a d e u p o f t w o 8 - b i t r e g i s t e r s : d p h ( h i g h b y t e ) a n d d p l ( l o w b y t e ) . t h e s e p r o v i d e m e m o r y a d d r e s s e s f o r i n t e r n a l c o d e a n d d a t a a c c e s s . t h e d p t r c a n b e m a n i p u l a t e d a s a 1 6 - b i t r e g i s t e r ( d p t r = d p h , d p l ) o r a s t w o i n d e p e n d e n t 8 - b i t r e g i s t e r s ( d p h , d p l ) . s e e t a b l e 4 8 a n d t a b l e 4 9 . t h e a d e 7 5 1 8 s u p p o r t s d u a l d a t a p o i n t e r s . s e e t h e d u a l d a t a p o i n t e r s s e c t i o n . n o t e t h a t t h e d u a l d a t a p o i n t e r s s e c t i o n i s t h e o n l y s e c t i o n i n t h e d a t a s h e e t w h e r e t h e m a i n a n d s h a d o w d a t a p o i n t e r s a r e d i s t i n g u i s h e d . w h e n e v e r t h e d a t a p o i n t e r ( d p t r ) i s m e n t i o n e d e l s e w h e r e i n t h e d a t a s h e e t , a c t i v e d p t r i s i m p l i e d . s t a c k p o i n t e r ( s p ) t h e s t a c k p o i n t e r k e e p s t r a c k o f t h e c u r r e n t a d d r e s s a t t h e t o p o f t h e s t a c k . t o p u s h a b y t e o f d a t a o n t o t h e s t a c k , t h e s t a c k p o i n t e r i s i n c r e m e n t e d , a n d t h e d a t a i s m o v e d t o t h e n e w t o p o f t h e s t a c k . t o p o p a b y t e o f d a t a o f f t h e s t a c k , t h e t o p b y t e o f d a t a i s m o v e d i n t o t h e a w a i t i n g a d d r e s s , a n d t h e s t a c k p o i n t e r i s d e c r e m e n t e d . t h e s t a c k i s a l a s t i n , f i r s t o u t ( l i f o ) m e t h o d o f d a t a s t o r a g e b e c a u s e t h e m o s t r e c e n t a d d i t i o n t o t h e s t a c k i s t h e f i r s t t o c o m e o f f i t . t h e s t a c k i s u t i l i z e d t o s t o r e t h e p r o g r a m a d d r e s s w h e n c a l l a n d r e t i n s t r u c t i o n s a r e e x e c u t e d s o t h a t t h e p r o g r a m c a n r e t u r n t o t h i s a d d r e s s w h e n r e t u r n i n g f r o m t h e f u n c t i o n c a l l . t h e s t a c k i s a l s o m a n i p u l a t e d w h e n v e c t o r i n g f o r i n t e r r u p t s t o k e e p t r a c k o f t h e p r i o r s t a t e o f t h e p c . t h e s t a c k r e s i d e s i n t h e i n t e r n a l e x t e n d e d r a m , a n d t h e s p r e g i s t e r h o l d s t h e a d d r e s s o f t h e s t a c k i n t h e e x t e n d e d r a m ( x r a m ) . t h e a d v a n t a g e o f t h i s s o l u t i o n i s t h a t t h e s t a c k i s s e g r e g a t e d t o t h e i n t e r n a l x r a m . t h e u s e o f t h e g e n e r a l - p u r p o s e r a m c a n b e l i m i t e d t o d a t a s t o r a g e , a n d t h e u s e o f t h e e x t e n d e d i n t e r n a l r a m c a n b e l i m i t e d t o t h e s t a c k p o i n t e r . t h i s s e p a r a t i o n l i m i t s t h e c h a n c e o f d a t a r a m c o r r u p t i o n w h e n t h e s t a c k p o i n t e r o v e r f l o w s i n d a t a r a m . d a t a c a n s t i l l b e s t o r e d i n x r a m b y u s i n g t h e m o v x c o m m a n d . 0 x 0 0 0 x f f 0 x f f 0 x 0 0 2 5 6 b y t e s o f o n - c h i p x r a m d a t a + s t a c k 2 5 6 b y t e s o f r a m ( d a t a ) 0 7 3 2 7 - 0 6 8 f i g u r e 6 8 . e x t e n d e d s t a c k p o i n t e r o p e r a t i o n t o c h a n g e t h e d e f a u l t s t a r t i n g a d d r e s s f o r t h e s t a c k , m o v e a v a l u e i n t o t h e s t a c k p o i n t e r ( s p ) . f o r e x a m p l e , t o e n a b l e t h e e x t e n d e d s t a c k p o i n t e r a n d i n i t i a l i z e i t a t t h e b e g i n n i n g o f t h e x r a m s p a c e , u s e t h e f o l l o w i n g c o d e : m o v s p , # 0 0 h
a d e 7 5 1 8 r e v . 0 | p a g e 6 6 o f 1 2 8 s t a n d a r d 8 0 5 2 s f r s t h e s t a n d a r d 8 0 5 2 s p e c i a l f u n c t i o n r e g i s t e r s i n c l u d e t h e a c c , b , p s w , d p t r , a n d s p s f r s d e s c r i b e d i n t h e b a s i c 8 0 5 2 r e g i s t e r s s e c t i o n . t h e s t a n d a r d 8 0 5 2 s f r s a l s o d e f i n e t h e t i m e r s , t h e s e r i a l p o r t i n t e r f a c e , t h e i n t e r r u p t s , t h e i / o p o r t s , a n d t h e p o w e r - d o w n m o d e s . t i m e r s f r s t h e 8 0 5 2 c o n t a i n s t h r e e 1 6 - b i t t i m e r s : t h e i d e n t i c a l t i m e r 0 a n d t i m e r 1 , a s w e l l a s a t i m e r 2 . t h e s e t i m e r s c a n a l s o f u n c t i o n a s e v e n t c o u n t e r s . t i m e r 2 h a s a c a p t u r e f e a t u r e w h e r e t h e v a l u e o f t h e t i m e r c a n b e c a p t u r e d i n t w o 8 - b i t r e g i s t e r s u p o n t h e a s s e r - t i o n o f a n e x t e r n a l i n p u t s i g n a l ( s e e t a b l e 9 1 a n d t h e t i m e r s s e c t i o n ) . s e r i a l p o r t s f r s t h e f u l l - d u p l e x s e r i a l p o r t p e r i p h e r a l r e q u i r e s t w o r e g i s t e r s : o n e f o r s e t t i n g u p t h e b a u d r a t e a n d o t h e r c o m m u n i c a t i o n p a r a m e t e r s , a n d a n o t h e r f o r t h e t r a n s m i t / r e c e i v e b u f f e r . t h e a d e 7 5 1 8 a l s o h a s e n h a n c e d s e r i a l p o r t f u n c t i o n a l i t y w i t h a d e d i c a t e d t i m e r f o r b a u d r a t e g e n e r a t i o n w i t h a f r a c t i o n a l d i v i s o r a n d a d d i t i o n a l e r r o r d e t e c t i o n . s e e t a b l e 1 2 0 a n d t h e u a r t s e r i a l i n t e r f a c e s e c t i o n . i n t e r r u p t s f r s t h e r e i s a t w o - t i e r e d i n t e r r u p t s y s t e m s t a n d a r d i n t h e 8 0 5 2 c o r e . t h e p r i o r i t y l e v e l f o r e a c h i n t e r r u p t s o u r c e i s i n d i v i d u a l l y s e l e c t a - b l e a s h i g h o r l o w . t h e a d e 7 5 1 8 e n h a n c e s t h i s i n t e r r u p t s y s t e m b y c r e a t i n g , i n e s s e n c e , a t h i r d i n t e r r u p t t i e r f o r t h e h i g h e s t p r i o r i t y , t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t ( s e e t h e i n t e r r u p t s y s t e m s e c t i o n ) . i / o p o r t s f r s t h e 8 0 5 2 c o r e s u p p o r t s f o u r i / o p o r t s , p o r t 0 t h r o u g h p o r t 3 , w h e r e p o r t 0 a n d p o r t 2 a r e t y p i c a l l y u s e d t o a c c e s s e x t e r n a l c o d e a n d d a t a s p a c e s . t h e a d e 7 5 1 8 , u n l i k e s t a n d a r d 8 0 5 2 p r o d u c t s , p r o v i d e s i n t e r n a l n o n v o l a t i l e f l a s h m e m o r y s o t h a t a n e x t e r n a l c o d e s p a c e i s u n n e c e s s a r y . t h e o n - c h i p l c d d r i v e r r e q u i r e s m a n y p i n s , s o m e o f w h i c h a r e d e d i c a t e d f o r l c d f u n c t i o n a l i t y , a n d o t h e r s t h a t c a n b e c o n f i g u r e d a s l c d o r g e n e r a l - p u r p o s e i n p u t s / o u t p u t s . d u e t o t h e l i m i t e d n u m b e r o f i / o p i n s , t h e a d e 7 5 1 8 d o e s n o t a l l o w a c c e s s t o e x t e r n a l c o d e a n d d a t a s p a c e s . t h e a d e 7 5 1 8 p r o v i d e s 2 0 p i n s t h a t c a n b e u s e d f o r g e n e r a l - p u r p o s e i / o . t h e s e p i n s a r e m a p p e d t o p o r t 0 , p o r t 1 , a n d p o r t 2 . t h e y a r e a c c e s s e d t h r o u g h t h r e e b i t - a d d r e s s a b l e 8 0 5 2 s f r s , p 0 , p 1 , a n d p 2 . a n o t h e r e n h a n c e d f e a t u r e o f t h e a d e 7 5 1 8 i s t h a t t h e w e a k p u l l - u p s t h a t a r e s t a n d a r d o n 8 0 5 2 p o r t 1 , p o r t 2 , a n d p o r t 3 c a n b e d i s a b l e d t o m a k e o p e n - d r a i n o u t p u t s , a s i s s t a n d a r d o n p o r t 0 . t h e w e a k p u l l - u p s c a n b e e n a b l e d o n a p i n - b y - p i n b a s i s ( s e e t h e i / o p o r t s s e c t i o n ) . p r o g r a m c o n t r o l r e g i s t e r ( p c o n , 0 x 8 7 ) t h e 8 0 5 2 c o r e d e f i n e s t w o p o w e r - d o w n m o d e s : p o w e r - d o w n a n d i d l e . t h e a d e 7 5 1 8 e n h a n c e s t h e p o w e r c o n t r o l c a p a b i l i t y o f t h e t r a d i t i o n a l 8 0 5 2 m c u w i t h a d d i t i o n a l p o w e r m a n a g e m e n t f u n c t i o n s . t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) i s u s e d t o d e f i n e p o w e r c o n t r o l - s p e c i f i c f u n c t i o n a l i t y f o r t h e a d e 7 5 1 8 . t h e p r o g r a m c o n t r o l s f r ( p c o n , 0 x 8 7 ) i s n o t b i t a d d r e s s a b l e ( s e e t h e p o w e r m a n a g e m e n t s e c t i o n ) . t h e a d e 7 5 1 8 h a s m a n y o t h e r p e r i p h e r a l s n o t s t a n d a r d t o t h e 8 0 5 2 c o r e , i n c l u d i n g x a d e e n e r g y m e a s u r e m e n t d s p x r t c x l c d d r i v e r x b a t t e r y s w i t c h o v e r / p o w e r m a n a g e m e n t x s p i / i 2 c c o m m u n i c a t i o n x f l a s h m e m o r y c o n t r o l l e r x w a t c h d o g t i m e r m e m o r y o v e r v i e w t h e a d e 7 5 1 8 c o n t a i n s t h e f o l l o w i n g m e m o r y b l o c k s : x 1 6 k b o f o n - c h i p f l a s h / e e p r o g r a m a n d d a t a m e m o r y x 2 5 6 b y t e s o f g e n e r a l - p u r p o s e r a m x 2 5 6 b y t e s o f i n t e r n a l e x t e n d e d r a m ( x r a m ) t h e 2 5 6 b y t e s o f g e n e r a l - p u r p o s e r a m s h a r e t h e u p p e r 1 2 8 b y t e s o f i t s a d d r e s s s p a c e w i t h s p e c i a l f u n c t i o n r e g i s t e r s . a l l o f t h e m e m o r y s p a c e s a r e s h o w n i n f i g u r e 6 9 . t h e a d d r e s s i n g m o d e s p e c i f i e s w h i c h m e m o r y s p a c e t o a c c e s s . g e n e r a l - p u r p o s e r a m g e n e r a l - p u r p o s e r a m r e s i d e s i n t h e 0 x 0 0 t h r o u g h 0 x f f m e m o r y l o c a t i o n s a n d c o n t a i n s t h e r e g i s t e r b a n k s . 1 1 1 0 0 1 0 0 r e s e t v a l u e o f s t a c k p o i n t e r f o u r b a n k s o f e i g h t r e g i s t e r s r 0 t o r 7 b i t - a d d r e s s a b l e ( b i t a d d r e s s e s ) g e n e r a l - p u r p o s e a r e a b a n k s s e l e c t e d v i a b i t s i n p s w 0 x 0 0 0 x 0 8 0 x 1 0 0 x 1 8 0 x 2 0 0 x 3 0 0 x 0 7 0 x 0 f 0 x 1 7 0 x 1 f 0 x 2 f 0 x 7 f 0 7 3 2 7 - 0 6 9 f i g u r e 6 9 . l o w e r 1 2 8 b y t e s o f i n t e r n a l d a t a m e m o r y a d d r e s s 0 x 8 0 t h r o u g h a d d r e s s 0 x f f o f g e n e r a l - p u r p o s e r a m a r e s h a r e d w i t h t h e s p e c i a l f u n c t i o n r e g i s t e r s . t h e m o d e o f a d d r e s s i n g d e t e r m i n e s w h i c h m e m o r y s p a c e i s a c c e s s e d , a s s h o w n i n f i g u r e 7 0 .
a d e 7 5 1 8 r e v . 0 | p a g e 6 7 o f 1 2 8 g e n e r a l - p u r p o s e r a m s p e c i a l f u n c t i o n r e g i s t e r s ( s f r s ) a c c e s s i b l e b y i n d i r e c t a d d r e s s i n g o n l y a c c e s s i b l e b y d i r e c t a n d i n d i r e c t a d d r e s s i n g a c c e s s i b l e b y d i r e c t a d d r e s s i n g o n l y 0 x f f 0 x 8 0 0 x 7 f 0 x 0 0 0 7 3 2 7 - 0 7 0 f i g u r e 7 0 . g e n e r a l - p u r p o s e r a m a n d s f r m e m o r y a d d r e s s o v e r l a p b o t h d i r e c t a n d i n d i r e c t a d d r e s s i n g c a n b e u s e d t o a c c e s s g e n e r a l - p u r p o s e r a m f r o m 0 x 0 0 t h r o u g h 0 x 7 f . h o w e v e r , o n l y i n d i r e c t a d d r e s s i n g c a n b e u s e d t o a c c e s s g e n e r a l - p u r p o s e r a m f r o m 0 x 8 0 t h r o u g h 0 x f f b e c a u s e t h i s a d d r e s s s p a c e s h a r e s t h e s a m e s p a c e w i t h t h e s p e c i a l f u n c t i o n r e g i s t e r s ( s f r s ) . t h e 8 0 5 2 c o r e a l s o h a s t h e m e a n s t o a c c e s s i n d i v i d u a l b i t s o f c e r t a i n a d d r e s s e s i n t h e g e n e r a l - p u r p o s e r a m a n d s p e c i a l f u n c t i o n m e m o r y s p a c e s . t h e i n d i v i d u a l b i t s o f g e n e r a l - p u r p o s e r a m a d d r e s s 0 x 2 0 t o r a m a d d r e s s 0 x 2 f c a n b e a c c e s s e d t h r o u g h b i t a d d r e s s 0 x 0 0 t h r o u g h b i t a d d r e s s 0 x 7 f . t h e b e n e f i t o f b i t a d d r e s s i n g i s t h a t t h e i n d i v i d u a l b i t s c a n b e a c c e s s e d q u i c k l y w i t h o u t t h e n e e d f o r b i t m a s k i n g , w h i c h t a k e s m o r e c o d e m e m o r y a n d e x e c u t i o n t i m e . t h e b i t a d d r e s s e s f o r g e n e r a l - p u r p o s e r a m a d d r e s s 0 x 2 0 t h r o u g h r a m a d d r e s s 0 x 2 f c a n b e s e e n i n f i g u r e 7 1 . b y t e a d d r e s s b i t a d d r e s s e s ( h e x a ) 0 x 2 f 0 x 2 e 0 x 2 d 0 x 2 c 0 x 2 b 0 x 2 a 0 x 2 9 0 x 2 8 0 x 2 7 0 x 2 6 0 x 2 5 0 x 2 4 0 x 2 3 0 x 2 2 0 x 2 1 0 x 2 0 7 f 7 7 6 f 6 7 5 f 5 7 4 f 4 7 3 f 3 7 2 f 2 7 1 f 1 7 0 f 0 7 7 e 7 6 6 e 6 6 5 e 5 6 4 e 4 6 3 e 3 6 2 e 2 6 1 e 1 6 0 e 0 6 7 d 7 5 6 d 6 5 5 d 5 5 4 d 4 5 3 d 3 5 2 d 2 5 1 d 1 5 0 d 0 5 7 c 7 4 6 c 6 4 5 c 5 4 4 c 4 4 3 c 3 4 2 c 2 4 1 c 1 4 0 c 0 4 7 b 7 3 6 b 6 3 5 b 5 3 4 b 4 3 3 b 3 3 2 b 2 3 1 b 1 3 0 b 0 3 7 a 7 2 6 a 6 2 5 a 5 2 4 a 4 2 3 a 3 2 2 a 2 2 1 a 1 2 0 a 0 2 7 9 7 1 6 9 6 1 5 9 5 1 4 9 4 1 3 9 3 1 2 9 2 1 1 9 1 1 0 9 0 1 7 8 7 0 6 8 6 0 5 8 5 0 4 8 4 0 3 8 3 0 2 8 2 0 1 8 1 0 0 8 0 0 0 7 3 2 7 - 0 7 1 f i g u r e 7 1 . b i t a d d r e s s a b l e a r e a o f g e n e r a l - p u r p o s e r a m b i t a d d r e s s i n g c a n b e u s e d f o r i n s t r u c t i o n s t h a t i n v o l v e b o o l e a n v a r i a b l e m a n i p u l a t i o n a n d p r o g r a m b r a n c h i n g ( s e e t h e i n s t r u c t i o n s e t s e c t i o n ) . s p e c i a l f u n c t i o n r e g i s t e r s s p e c i a l f u n c t i o n r e g i s t e r s a r e r e g i s t e r s t h a t a f f e c t t h e f u n c t i o n o f t h e 8 0 5 2 c o r e o r i t s p e r i p h e r a l s . t h e s e r e g i s t e r s a r e l o c a t e d i n r a m i n a d d r e s s 0 x 8 0 t h r o u g h a d d r e s s 0 x f f . t h e y a r e o n l y a c c e s s i b l e t h r o u g h d i r e c t a d d r e s s i n g , a s s h o w n i n f i g u r e 7 0 . t h e i n d i v i d u a l b i t s o f s o m e s f r s c a n b e a c c e s s e d f o r u s e i n b o o l e a n a n d p r o g r a m b r a n c h i n g i n s t r u c t i o n s . t h e s e s f r s a r e l a b e l e d a s b i t - a d d r e s s a b l e a n d t h e b i t a d d r e s s e s a r e g i v e n i n t h e s f r m a p p i n g s e c t i o n . e x t e n d e d i n t e r n a l r a m ( x r a m ) t h e a d e 7 5 1 8 p r o v i d e s 2 5 6 b y t e s o f e x t e n d e d o n - c h i p r a m , w h i c h i s l o c a t e d i n a d d r e s s 0 x 0 0 0 0 t h r o u g h a d d r e s s 0 x 0 0 f f i n t h e e x t e n d e d r a m s p a c e . n o e x t e r n a l r a m i s s u p p o r t e d . t o s e l e c t t h e e x t e n d e d r a m m e m o r y s p a c e , t h e e x t e n d e d i n d i r e c t a d d r e s s i n g m o d e s a r e u s e d . t h e i n t e r n a l x r a m i s e n a b l e d i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) b y w r i t i n g 0 1 t o c f g [ 1 : 0 ] . 2 5 6 b y t e s o f e x t e n d e d i n t e r n a l r a m ( x r a m ) 0 x 0 0 f f 0 x 0 0 0 0 0 7 3 2 7 - 0 7 2 f i g u r e 7 2 . e x t e n d e d i n t e r n a l r a m ( x r a m ) s p a c e c o d e m e m o r y c o d e a n d d a t a m e m o r y a r e s t o r e d i n t h e 1 6 k b f l a s h m e m o r y s p a c e . n o e x t e r n a l c o d e m e m o r y i s s u p p o r t e d . t o a c c e s s c o d e m e m o r y , c o d e i n d i r e c t a d d r e s s i n g i s u s e d . a d d r e s s i n g m o d e s t h e 8 0 5 2 c o r e p r o v i d e s s e v e r a l a d d r e s s i n g m o d e s . t h e a d d r e s s - i n g m o d e d e t e r m i n e s h o w t h e c o r e i n t e r p r e t s t h e m e m o r y l o c a t i o n o r d a t a v a l u e s p e c i f i e d i n a s s e m b l y l a n g u a g e c o d e . t h e r e a r e s i x a d d r e s s i n g m o d e s , a s s h o w n i n t a b l e 5 3 . t a b l e 5 3 . 8 0 5 2 a d d r e s s i n g m o d e s a d d r e s s i n g m o d e e x a m p l e b y t e s c o r e c l o c k c y c l e s i m m e d i a t e m o v a , # a 8 h 2 2 m o v d p t r , # a 8 h 3 3 d i r e c t m o v a , a 8 h 2 2 m o v a , i e 2 2 m o v a , r 0 1 1 i n d i r e c t m o v a , @ r 0 1 2 e x t e n d e d d i r e c t m o v x a , @ d p t r 1 4 e x t e n d e d i n d i r e c t m o v x a , @ r 0 1 4 c o d e i n d i r e c t m o v c a , @ a + d p t r 1 4 m o v c a , @ a + p c 1 4 j m p @ a + d p t r 1 3 i m m e d i a t e a d d r e s s i n g i n i m m e d i a t e a d d r e s s i n g , t h e e x p r e s s i o n e n t e r e d a f t e r t h e n u m b e r s i g n ( # ) i s e v a l u a t e d b y t h e a s s e m b l e r a n d s t o r e d i n t h e s p e c i f i e d m e m o r y a d d r e s s . t h i s n u m b e r i s r e f e r r e d t o a s a l i t e r a l b e c a u s e i t r e f e r s o n l y t o a v a l u e a n d n o t t o a m e m o r y l o c a t i o n . i n s t r u c t i o n s u s i n g t h i s a d d r e s s i n g m o d e a r e s l o w e r t h a n t h o s e b e t w e e n t w o r e g i s t e r s b e c a u s e t h e l i t e r a l m u s t b e s t o r e d a n d f e t c h e d f r o m m e m o r y . t h e e x p r e s s i o n c a n b e e n t e r e d a s a s y m b o l i c v a r i a b l e o r a n a r i t h m e t i c e x p r e s s i o n ; t h e v a l u e i s c o m p u t e d b y t h e a s s e m b l e r .
a d e 7 5 1 8 r e v . 0 | p a g e 6 8 o f 1 2 8 d i r e c t a d d r e s s i n g w i t h d i r e c t a d d r e s s i n g , t h e v a l u e a t t h e s o u r c e a d d r e s s i s m o v e d t o t h e d e s t i n a t i o n a d d r e s s . d i r e c t a d d r e s s i n g p r o v i d e s t h e f a s t e s t e x e c u t i o n t i m e o f a l l t h e a d d r e s s i n g m o d e s w h e n a n i n s t r u c t i o n i s p e r f o r m e d b e t w e e n r e g i s t e r s . n o t e t h a t i n d i r e c t o r d i r e c t a d d r e s s i n g m o d e s c a n b e u s e d t o a c c e s s g e n e r a l - p u r p o s e r a m a d d r e s s 0 x 0 0 t h r o u g h r a m a d d r e s s 0 x 7 f . a n i n s t r u c t i o n w i t h d i r e c t a d d r e s s i n g t h a t u s e s a n a d d r e s s b e t w e e n 0 x 8 0 a n d 0 x f f i s r e f e r r i n g t o a s p e c i a l f u n c t i o n m e m o r y l o c a t i o n . i n d i r e c t a d d r e s s i n g w i t h i n d i r e c t a d d r e s s i n g , t h e v a l u e p o i n t e d t o b y t h e r e g i s t e r i s m o v e d t o t h e d e s t i n a t i o n a d d r e s s . f o r e x a m p l e , t o m o v e t h e c o n t e n t s o f i n t e r n a l r a m a d d r e s s 0 x 8 2 t o t h e a c c u m u l a t o r , u s e t h e f o l l o w i n g i n s t r u c t i o n s : m o v r 0 , # 8 2 h m o v a , @ r 0 t h e s e t w o i n s t r u c t i o n s r e q u i r e a t o t a l o f f o u r c l o c k c y c l e s a n d t h r e e b y t e s o f s t o r a g e i n t h e p r o g r a m m e m o r y . i n d i r e c t a d d r e s s i n g a l l o w s a d d r e s s e s t o b e c o m p u t e d , w h i c h i s u s e f u l f o r i n d e x i n g i n t o d a t a a r r a y s s t o r e d i n r a m . n o t e t h a t a n i n s t r u c t i o n t h a t r e f e r s t o a d d r e s s 0 x 0 0 t h r o u g h a d d r e s s 0 x 7 f i s r e f e r r i n g t o i n t e r n a l r a m , a n d i n d i r e c t o r d i r e c t a d d r e s s i n g m o d e s c a n b e u s e d . a n i n s t r u c t i o n w i t h i n d i r e c t a d d r e s s i n g t h a t u s e s a n a d d r e s s b e t w e e n 0 x 8 0 a n d 0 x f f i s r e f e r r i n g t o i n t e r n a l r a m , n o t t o a n s f r . e x t e n d e d d i r e c t a d d r e s s i n g t h e d p t r r e g i s t e r ( s e e t a b l e 5 0 ) i s u s e d t o a c c e s s i n t e r n a l e x t e n d e d r a m i n e x t e n d e d i n d i r e c t a d d r e s s i n g m o d e . t h e a d e 7 5 1 8 h a s 2 5 6 b y t e s o f x r a m , a c c e s s e d t h r o u g h m o v x i n s t r u c t i o n s . e x t e r n a l m e m o r y s p a c e s a r e n o t s u p p o r t e d o n t h i s d e v i c e . i n e x t e n d e d d i r e c t a d d r e s s i n g m o d e , t h e d p t r r e g i s t e r p o i n t s t o t h e a d d r e s s o f t h e b y t e o f e x t e n d e d r a m . t h e f o l l o w i n g c o d e m o v e s t h e c o n t e n t s o f e x t e n d e d r a m a d d r e s s 0 x 1 0 0 t o t h e a c c u m u l a t o r : m o v d p t r , # 1 0 0 h m o v x a , @ d p t r t h e s e t w o i n s t r u c t i o n s r e q u i r e a t o t a l o f s e v e n c l o c k c y c l e s a n d f o u r b y t e s o f s t o r a g e i n t h e p r o g r a m m e m o r y . e x t e n d e d i n d i r e c t a d d r e s s i n g t h e i n t e r n a l e x t e n d e d r a m i s a c c e s s e d t h r o u g h a p o i n t e r t o t h e a d d r e s s i n i n d i r e c t a d d r e s s i n g m o d e . t h e a d e 7 5 1 8 h a s 2 5 6 b y t e s o f i n t e r n a l e x t e n d e d r a m , a c c e s s e d t h r o u g h m o v x i n s t r u c t i o n s . e x t e r n a l m e m o r y i s n o t s u p p o r t e d o n t h e d e v i c e s . i n e x t e n d e d i n d i r e c t a d d r e s s i n g m o d e , a r e g i s t e r h o l d s t h e a d d r e s s o f t h e b y t e o f e x t e n d e d r a m . t h e f o l l o w i n g c o d e m o v e s t h e c o n t e n t s o f e x t e n d e d r a m a d d r e s s 0 x 8 0 t o t h e a c c u m u l a t o r : m o v r 0 , # 8 0 h m o v x a , @ r 0 t h e s e t w o i n s t r u c t i o n s r e q u i r e s i x c l o c k c y c l e s a n d t h r e e b y t e s o f s t o r a g e . n o t e t h a t t h e r e a r e 2 5 6 b y t e s o f e x t e n d e d r a m ; t h e r e f o r e , b o t h e x t e n d e d d i r e c t a n d e x t e n d e d i n d i r e c t a d d r e s s i n g c a n c o v e r t h e w h o l e a d d r e s s r a n g e . t h e r e i s a s t o r a g e a n d s p e e d a d v a n t a g e t o u s i n g e x t e n d e d i n d i r e c t a d d r e s s i n g b e c a u s e t h e a d d i t i o n a l b y t e o f a d d r e s s i n g a v a i l a b l e t h r o u g h t h e d p t r r e g i s t e r t h a t i s n o t n e e d e d i s n o t s t o r e d . f r o m t h e t h r e e e x a m p l e s d e m o n s t r a t i n g t h e a c c e s s o f i n t e r n a l r a m f r o m 0 x 8 0 t h r o u g h 0 x f f , a n d t h e a c c e s s o f e x t e n d e d i n t e r n a l r a m f r o m 0 x 0 0 t h r o u g h 0 x f f , i t c a n b e s e e n t h a t i t i s m o s t e f f i c i e n t t o u s e t h e e n t i r e i n t e r n a l r a m a c c e s s i b l e t h r o u g h i n d i r e c t a c c e s s b e f o r e m o v i n g t o e x t e n d e d r a m . c o d e i n d i r e c t a d d r e s s i n g t h e i n t e r n a l c o d e m e m o r y c a n b e a c c e s s e d i n d i r e c t l y . t h i s c a n b e u s e f u l f o r i m p l e m e n t i n g l o o k u p t a b l e s a n d o t h e r a r r a y s o f c o n s t a n t s t h a t a r e s t o r e d i n f l a s h . f o r e x a m p l e , t o m o v e t h e d a t a s t o r e d i n f l a s h m e m o r y a t a d d r e s s 0 x 8 0 0 2 i n t o t h e a c c u m u l a t o r , u s e t h e f o l l o w i n g c o d e : m o v d p t r , # 8 0 0 2 h c l r a m o v x a , @ a + d p t r t h e a c c u m u l a t o r c a n b e u s e d a s a v a r i a b l e i n d e x i n t o t h e a r r a y o f f l a s h m e m o r y l o c a t e d a t d p t r .
a d e 7 5 1 8 r e v . 0 | p a g e 6 9 o f 1 2 8 i n s t r u c t i o n s e t t a b l e 5 4 d o c u m e n t s t h e n u m b e r o f c l o c k c y c l e s r e q u i r e d f o r e a c h i n s t r u c t i o n . m o s t i n s t r u c t i o n s a r e e x e c u t e d i n o n e o r t w o c l o c k c y c l e s , r e s u l t i n g i n a 4 - m i p s p e a k p e r f o r m a n c e . t a b l e 5 4 . i n s t r u c t i o n s e t m n e m o n i c d e s c r i p t i o n b y t e s c y c l e s a r i t h m e t i c a d d a , r n a d d r e g i s t e r t o a 1 1 a d d a , @ r i a d d i n d i r e c t m e m o r y t o a 1 2 a d d a , d i r a d d d i r e c t b y t e t o a 2 2 a d d a , # d a t a a d d i m m e d i a t e t o a 2 2 a d d c a , r n 1 1 a d d r e g i s t e r t o a w i t h c a r r y 1 1 a d d c a , @ r i a d d i n d i r e c t m e m o r y t o a w i t h c a r r y 1 2 a d d c a , d i r a d d d i r e c t b y t e t o a w i t h c a r r y 2 2 a d d c a , # d a t a a d d i m m e d i a t e t o a w i t h c a r r y 2 2 s u b b a , r n s u b t r a c t r e g i s t e r f r o m a w i t h b o r r o w 1 1 s u b b a , @ r i s u b t r a c t i n d i r e c t m e m o r y f r o m a w i t h b o r r o w 1 2 s u b b a , d i r s u b t r a c t d i r e c t f r o m a w i t h b o r r o w 2 2 s u b b a , # d a t a s u b t r a c t i m m e d i a t e f r o m a w i t h b o r r o w 2 2 i n c a i n c r e m e n t a 1 1 i n c r n i n c r e m e n t r e g i s t e r 1 1 i n c @ r i i n c r e m e n t i n d i r e c t m e m o r y 1 2 i n c d i r i n c r e m e n t d i r e c t b y t e 2 2 i n c d p t r i n c r e m e n t d a t a p o i n t e r 1 3 d e c a d e c r e m e n t a 1 1 d e c r n d e c r e m e n t r e g i s t e r 1 1 d e c @ r i d e c r e m e n t i n d i r e c t m e m o r y 1 2 d e c d i r d e c r e m e n t d i r e c t b y t e 2 2 m u l a b m u l t i p l y a b y b 1 9 d i v a b d i v i d e a b y b 1 9 d a a d e c i m a l a d j u s t a 1 2 l o g i c a n l a , r n a n d r e g i s t e r t o a 1 1 a n l a , @ r i a n d i n d i r e c t m e m o r y t o a 1 2 a n l a , d i r a n d d i r e c t b y t e t o a 2 2 a n l a , # d a t a a n d i m m e d i a t e t o a 2 2 a n l d i r , a a n d a t o d i r e c t b y t e 2 2 a n l d i r , # d a t a a n d i m m e d i a t e d a t a t o d i r e c t b y t e 3 3 o r l a , r n o r r e g i s t e r t o a 1 1 o r l a , @ r i o r i n d i r e c t m e m o r y t o a 1 2 o r l a , d i r o r d i r e c t b y t e t o a 2 2 o r l a , # d a t a o r i m m e d i a t e t o a 2 2 o r l d i r , a o r a t o d i r e c t b y t e 2 2 o r l d i r , # d a t a o r i m m e d i a t e d a t a t o d i r e c t b y t e 3 3 x r l a , r n e x c l u s i v e o r r e g i s t e r t o a 1 1 x r l a , @ r i e x c l u s i v e o r i n d i r e c t m e m o r y t o a 2 2 x r l a , # d a t a e x c l u s i v e o r i m m e d i a t e t o a 2 2 x r l d i r , a e x c l u s i v e o r a t o d i r e c t b y t e 2 2 x r l a , d i r e x c l u s i v e o r i n d i r e c t m e m o r y t o a 2 2 x r l d i r , # d a t a e x c l u s i v e o r i m m e d i a t e d a t a t o d i r e c t 3 3 c l r a c l e a r a 1 1 c p l a c o m p l e m e n t a 1 1 s w a p a s w a p n i b b l e s o f a 1 1 r l a r o t a t e a l e f t 1 1
a d e 7 5 1 8 r e v . 0 | p a g e 7 0 o f 1 2 8 m n e m o n i c d e s c r i p t i o n b y t e s c y c l e s r l c a r o t a t e a l e f t t h r o u g h c a r r y 1 1 r r a r o t a t e a r i g h t 1 1 r r c a r o t a t e a r i g h t t h r o u g h c a r r y 1 1 d a t a t r a n s f e r m o v a , r n m o v e r e g i s t e r t o a 1 1 m o v a , @ r i m o v e i n d i r e c t m e m o r y t o a 1 2 m o v r n , a m o v e a t o r e g i s t e r 1 1 m o v @ r i , a m o v e a t o i n d i r e c t m e m o r y 1 2 m o v a , d i r m o v e d i r e c t b y t e t o a 2 2 m o v a , # d a t a m o v e i m m e d i a t e t o a 2 2 m o v r n , # d a t a m o v e r e g i s t e r t o i m m e d i a t e 2 2 m o v d i r , a m o v e a t o d i r e c t b y t e 2 2 m o v r n , d i r m o v e r e g i s t e r t o d i r e c t b y t e 2 2 m o v d i r , r n m o v e d i r e c t t o r e g i s t e r 2 2 m o v @ r i , # d a t a m o v e i m m e d i a t e t o i n d i r e c t m e m o r y 2 2 m o v d i r , @ r i m o v e i n d i r e c t t o d i r e c t m e m o r y 2 2 m o v @ r i , d i r m o v e d i r e c t t o i n d i r e c t m e m o r y 2 2 m o v d i r , d i r m o v e d i r e c t b y t e t o d i r e c t b y t e 3 3 m o v d i r , # d a t a m o v e i m m e d i a t e t o d i r e c t b y t e 3 3 m o v d p t r , # d a t a m o v e i m m e d i a t e t o d a t a p o i n t e r 3 3 m o v c a , @ a + d p t r m o v e c o d e b y t e r e l a t i v e d p t r t o a 1 4 m o v c a , @ a + p c m o v e c o d e b y t e r e l a t i v e p c t o a 1 4 m o v x a , @ r i m o v e e x t e r n a l ( a 8 ) d a t a t o a 1 4 m o v x a , @ d p t r m o v e e x t e r n a l ( a 1 6 ) d a t a t o a 1 4 m o v x @ r i , a m o v e a t o e x t e r n a l d a t a ( a 8 ) 1 4 m o v x @ d p t r , a m o v e a t o e x t e r n a l d a t a ( a 1 6 ) 1 4 p u s h d i r p u s h d i r e c t b y t e o n t o s t a c k 2 2 p o p d i r p o p d i r e c t b y t e f r o m s t a c k 2 2 x c h a , r n e x c h a n g e a a n d r e g i s t e r 1 1 x c h a , @ r i e x c h a n g e a a n d i n d i r e c t m e m o r y 1 2 x c h d a , @ r i e x c h a n g e a a n d i n d i r e c t m e m o r y n i b b l e 1 2 x c h a , d i r e x c h a n g e a a n d d i r e c t b y t e 2 2 b o o l e a n c l r c c l e a r c a r r y 1 1 c l r b i t c l e a r d i r e c t b i t 2 2 s e t b c s e t c a r r y 1 1 s e t b b i t s e t d i r e c t b i t 2 2 c p l c c o m p l e m e n t c a r r y 1 1 c p l b i t c o m p l e m e n t d i r e c t b i t 2 2 a n l c , b i t a n d d i r e c t b i t a n d c a r r y 2 2 a n l c , / b i t a n d d i r e c t b i t i n v e r s e t o c a r r y 2 2 o r l c , b i t o r d i r e c t b i t a n d c a r r y 2 2 o r l c , / b i t o r d i r e c t b i t i n v e r s e t o c a r r y 2 2 m o v c , b i t m o v e d i r e c t b i t t o c a r r y 2 2 m o v b i t , c m o v e c a r r y t o d i r e c t b i t 2 2 b r a n c h i n g j m p @ a + d p t r j u m p i n d i r e c t r e l a t i v e t o d p t r 1 3 r e t r e t u r n f r o m s u b r o u t i n e 1 4 r e t i r e t u r n f r o m i n t e r r u p t 1 4 a c a l l a d d r 1 1 a b s o l u t e j u m p t o s u b r o u t i n e 2 3 a j m p a d d r 1 1 a b s o l u t e j u m p u n c o n d i t i o n a l 2 3 s j m p r e l s h o r t j u m p ( r e l a t i v e a d d r e s s ) 2 3 j c r e l j u m p o n c a r r y e q u a l t o 1 2 3
a d e 7 5 1 8 r e v . 0 | p a g e 7 1 o f 1 2 8 m n e m o n i c d e s c r i p t i o n b y t e s c y c l e s j n c r e l j u m p o n c a r r y = 0 2 3 j z r e l j u m p o n a c c u m u l a t o r = 0 2 3 j n z r e l j u m p o n a c c u m u l a t o r  0 2 3 d j n z r n , r e l d e c r e m e n t r e g i s t e r , j n z r e l a t i v e 2 3 l j m p l o n g j u m p u n c o n d i t i o n a l 3 4 l c a l l a d d r 1 6 l o n g j u m p t o s u b r o u t i n e 3 4 j b b i t , r e l j u m p o n d i r e c t b i t = 1 3 4 j n b b i t , r e l j u m p o n d i r e c t b i t = 0 3 4 j b c b i t , r e l j u m p o n d i r e c t b i t = 1 a n d c l e a r 3 4 c j n e a , d i r , r e l c o m p a r e a , d i r e c t j n e r e l a t i v e 3 4 c j n e a , # d a t a , r e l c o m p a r e a , i m m e d i a t e j n e r e l a t i v e 3 4 c j n e r n , # d a t a , r e l c o m p a r e r e g i s t e r , i m m e d i a t e j n e r e l a t i v e 3 4 c j n e @ r i , # d a t a , r e l c o m p a r e i n d i r e c t , i m m e d i a t e j n e r e l a t i v e 3 4 d j n z d i r , r e l d e c r e m e n t d i r e c t b y t e , j n z r e l a t i v e 3 4 m i s c e l l a n e o u s n o p n o o p e r a t i o n 1 1 r e a d - m o d i f y - w r i t e i n s t r u c t i o n s s o m e 8 0 5 2 i n s t r u c t i o n s r e a d t h e l a t c h a n d o t h e r s r e a d t h e p i n . t h e s t a t e o f t h e p i n i s r e a d f o r i n s t r u c t i o n s t h a t i n p u t a p o r t b i t . i n s t r u c t i o n s t h a t r e a d t h e l a t c h r a t h e r t h a n t h e p i n a r e t h e o n e s t h a t r e a d a v a l u e , p o s s i b l y c h a n g e i t , a n d r e w r i t e i t t o t h e l a t c h . b e c a u s e t h e s e i n s t r u c t i o n s i n v o l v e m o d i f y i n g t h e p o r t , i t i s a s s u m e d t h a t t h e p i n b e i n g m o d i f i e d i s a n o u t p u t , s o t h e o u t p u t s t a t e o f t h e p i n i s r e a d f r o m t h e l a t c h . t h i s p r e v e n t s a p o s s i b l e m i s i n t e r p r e t a t i o n o f t h e v o l t a g e l e v e l o f a p i n . f o r e x a m p l e , i f a p o r t p i n i s u s e d t o d r i v e t h e b a s e o f a t r a n s i s t o r , a 1 i s w r i t t e n t o t h e b i t t o t u r n o n t h e t r a n s i s t o r . i f t h e c p u r e a d s t h e s a m e p o r t b i t a t t h e p i n r a t h e r t h a n t h e l a t c h , i t r e a d s t h e b a s e v o l t a g e o f t h e t r a n s i s t o r a n d i n t e r p r e t s i t a s l o g i c 0 . r e a d i n g t h e l a t c h r a t h e r t h a n t h e p i n r e t u r n s t h e c o r r e c t v a l u e o f 1 . t h e i n s t r u c t i o n s t h a t r e a d t h e l a t c h r a t h e r t h a n t h e p i n a r e c a l l e d r e a d - m o d i f y - w r i t e i n s t r u c t i o n s a n d a r e l i s t e d i n t a b l e 5 5 . w h e n t h e d e s t i n a t i o n o p e r a n d i s a p o r t o r a p o r t b i t , t h e s e i n s t r u c t i o n s r e a d t h e l a t c h r a t h e r t h a n t h e p i n . t a b l e 5 5 . r e a d - m o d i f y - w r i t e i n s t r u c t i o n s i n s t r u c t i o n e x a m p l e d e s c r i p t i o n a n l a n l p 0 , a l o g i c a n d . o r l o r l p 1 , a l o g i c o r . x r l x r l p 2 , a l o g i c x o r . j b c j b c p 1 . 1 , l a b e l j u m p i f b i t = 1 a n d c l e a r b i t . c p l c p l p 2 . 0 c o m p l e m e n t b i t . i n c i n c p 2 i n c r e m e n t . d e c d e c p 2 d e c r e m e n t . d j n z d j n z p 0 , l a b e l d e c r e m e n t a n d j u m p i f n o t z e r o . m o v p x . y , c 1 m o v p 0 . 0 , c m o v e c a r r y t o b i t y o f p o r t x . c l r p x . y 1 c l r p 0 . 0 c l e a r b i t y o f p o r t x . s e t b p x . y 1 s e t b p 0 . 0 s e t b i t y o f p o r t x . 1 t h e s e i n s t r u c t i o n s r e a d t h e p o r t b y t e ( a l l e i g h t b i t s ) , m o d i f y t h e a d d r e s s e d b i t , a n d w r i t e t h e n e w b y t e b a c k t o t h e l a t c h . i n s t r u c t i o n s t h a t a f f e c t f l a g s m a n y i n s t r u c t i o n s e x p l i c i t l y m o d i f y t h e c a r r y b i t , s u c h a s t h e m o v c b i t a n d c l r c i n s t r u c t i o n s . o t h e r i n s t r u c t i o n s t h a t a f f e c t s t a t u s f l a g s a r e l i s t e d i n t h i s s e c t i o n . a d d a , s o u r c e t h i s i n s t r u c t i o n a d d s t h e s o u r c e t o t h e a c c u m u l a t o r . n o s t a t u s f l a g s a r e r e f e r e n c e d b y t h e i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g s c s e t i f t h e r e i s a c a r r y o u t o f b i t 7 . c l e a r e d o t h e r w i s e . u s e d t o i n d i c a t e a n o v e r f l o w i f t h e o p e r a n d s a r e u n s i g n e d . o v s e t i f t h e r e i s a c a r r y o u t o f b i t 6 o r a c a r r y o u t o f b i t 7 , b u t n o t i f b o t h a r e s e t . u s e d t o i n d i c a t e a n o v e r f l o w f o r s i g n e d a d d i t i o n . t h i s f l a g i s s e t i f t w o p o s i t i v e o p e r a n d s y i e l d a n e g a t i v e r e s u l t o r i f t w o n e g a t i v e o p e r a n d s y i e l d a p o s i t i v e r e s u l t . a c s e t i f t h e r e i s a c a r r y o u t o f b i t 3 . c l e a r e d o t h e r w i s e . a d d c a , s o u r c e t h i s i n s t r u c t i o n a d d s t h e s o u r c e a n d t h e c a r r y b i t t o t h e a c c u - m u l a t o r . t h e c a r r y s t a t u s f l a g i s r e f e r e n c e d b y t h e i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g s c s e t i f t h e r e i s a c a r r y o u t o f b i t 7 . c l e a r e d o t h e r w i s e . u s e d t o i n d i c a t e a n o v e r f l o w i f t h e o p e r a n d s a r e u n s i g n e d . o v s e t i f t h e r e i s a c a r r y o u t o f b i t 6 o r a c a r r y o u t o f b i t 7 , b u t n o t i f b o t h a r e s e t . u s e d t o i n d i c a t e a n o v e r f l o w f o r s i g n e d a d d i t i o n . t h i s f l a g i s s e t i f t w o p o s i t i v e o p e r a n d s y i e l d a n e g a t i v e r e s u l t o r i f t w o n e g a t i v e o p e r a n d s y i e l d a p o s i t i v e r e s u l t . a c s e t i f t h e r e i s a c a r r y o u t o f b i t 3 . c l e a r e d o t h e r w i s e .
a d e 7 5 1 8 r e v . 0 | p a g e 7 2 o f 1 2 8 s u b b a , s o u r c e t h i s i n s t r u c t i o n s u b t r a c t s t h e s o u r c e b y t e a n d t h e c a r r y ( b o r r o w ) f l a g f r o m t h e a c c u m u l a t o r . i t r e f e r e n c e s t h e c a r r y ( b o r r o w ) s t a t u s f l a g . a f f e c t e d s t a t u s f l a g s c s e t i f t h e r e i s a b o r r o w n e e d e d f o r b i t 7 . c l e a r e d o t h e r w i s e . u s e d t o i n d i c a t e a n o v e r f l o w i f t h e o p e r a n d s a r e u n s i g n e d . o v s e t i f t h e r e i s a b o r r o w n e e d e d f o r b i t 6 o r b i t 7 , b u t n o t f o r b o t h . u s e d t o i n d i c a t e a n o v e r f l o w f o r s i g n e d s u b t r a c t i o n . t h i s f l a g i s s e t i f a n e g a t i v e n u m b e r s u b t r a c t e d f r o m a p o s i t i v e y i e l d s a n e g a t i v e r e s u l t o r i f a p o s i t i v e n u m b e r s u b t r a c t e d f r o m a n e g a t i v e n u m b e r y i e l d s a p o s i t i v e r e s u l t . a c s e t i f a b o r r o w i s n e e d e d f o r b i t 3 . c l e a r e d o t h e r w i s e . m u l a b t h i s i n s t r u c t i o n m u l t i p l i e s t h e a c c u m u l a t o r b y t h e b r e g i s t e r . t h i s o p e r a t i o n i s u n s i g n e d . t h e l o w e r b y t e o f t h e 1 6 - b i t p r o d u c t i s s t o r e d i n t h e a c c u m u l a t o r a n d t h e h i g h e r b y t e i s l e f t i n t h e b r e g i s t e r . n o s t a t u s f l a g s a r e r e f e r e n c e d b y t h e i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g s c c l e a r e d . o v s e t i f t h e r e s u l t i s g r e a t e r t h a n 2 5 5 . c l e a r e d o t h e r w i s e . d i v a b t h i s i n s t r u c t i o n d i v i d e s t h e a c c u m u l a t o r b y t h e b r e g i s t e r . t h i s o p e r a t i o n i s u n s i g n e d . t h e i n t e g e r p a r t o f t h e q u o t i e n t i s s t o r e d i n t h e a c c u m u l a t o r a n d t h e r e m a i n d e r g o e s i n t o t h e b r e g i s t e r . n o s t a t u s f l a g s a r e r e f e r e n c e d b y t h e i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g s c c l e a r e d . o v c l e a r e d u n l e s s t h e b r e g i s t e r i s e q u a l t o 0 , i n w h i c h c a s e t h e r e s u l t s o f t h e d i v i s i o n a r e u n d e f i n e d a n d t h e o v f l a g i s s e t . d a a t h i s i n s t r u c t i o n a d j u s t s t h e a c c u m u l a t o r t o h o l d t w o 4 - b i t d i g i t s a f t e r t h e a d d i t i o n o f t w o b i n a r y c o d e d d e c i m a l s ( b c d s ) w i t h t h e a d d o r a d d c i n s t r u c t i o n s . i f t h e a c b i t i s s e t o r i f t h e v a l u e o f b i t 0 t o b i t 3 e x c e e d s n i n e , 0 x 0 6 i s a d d e d t o t h e a c c u m u l a t o r t o c o r r e c t t h e l o w e r f o u r b i t s . i f t h e c a r r y b i t i s s e t w h e n t h e i n s t r u c t i o n b e g i n s , o r i f 0 x 0 6 i s a d d e d t o t h e a c c u m u l a t o r i n t h e f i r s t s t e p , 0 x 6 0 i s a d d e d t o t h e a c c u m u l a t o r t o c o r r e c t t h e h i g h e r f o u r b i t s . t h e c a r r y a n d a c s t a t u s f l a g s a r e r e f e r e n c e d b y t h i s i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g c s e t i f t h e r e s u l t i s g r e a t e r t h a n 0 x 9 9 . c l e a r e d o t h e r w i s e . r r c a t h i s i n s t r u c t i o n r o t a t e s t h e a c c u m u l a t o r t o t h e r i g h t t h r o u g h t h e c a r r y f l a g . t h e o l d l s b o f t h e a c c u m u l a t o r b e c o m e s t h e n e w c a r r y f l a g , a n d t h e o l d c a r r y f l a g i s l o a d e d i n t o t h e n e w m s b o f t h e a c c u m u l a t o r . t h e c a r r y s t a t u s f l a g i s r e f e r e n c e d b y t h i s i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g c e q u a l t o t h e s t a t e o f a c c . 0 b e f o r e e x e c u t i o n o f t h e i n s t r u c t i o n . r l c a t h i s i n s t r u c t i o n r o t a t e s t h e a c c u m u l a t o r t o t h e l e f t t h r o u g h t h e c a r r y f l a g . t h e o l d m s b o f t h e a c c u m u l a t o r b e c o m e s t h e n e w c a r r y f l a g , a n d t h e o l d c a r r y f l a g i s l o a d e d i n t o t h e n e w l s b o f t h e a c c u m u l a t o r . t h e c a r r y s t a t u s f l a g i s r e f e r e n c e d b y t h i s i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g c e q u a l t o t h e s t a t e o f a c c . 7 b e f o r e e x e c u t i o n o f t h e i n s t r u c t i o n . c j n e d e s t i n a t i o n , s o u r c e , r e l a t i v e j u m p t h i s i n s t r u c t i o n c o m p a r e s t h e s o u r c e v a l u e t o t h e d e s t i n a t i o n v a l u e a n d b r a n c h e s t o t h e l o c a t i o n s e t b y t h e r e l a t i v e j u m p i f t h e y a r e n o t e q u a l . i f t h e v a l u e s a r e e q u a l , p r o g r a m e x e c u t i o n c o n t i n u e s w i t h t h e i n s t r u c t i o n a f t e r t h e c j n e i n s t r u c t i o n . n o s t a t u s f l a g s a r e r e f e r e n c e d b y t h i s i n s t r u c t i o n . a f f e c t e d s t a t u s f l a g c s e t i f t h e s o u r c e v a l u e i s g r e a t e r t h a n t h e d e s t i n a t i o n v a l u e . c l e a r e d o t h e r w i s e .
a d e 7 5 1 8 r e v . 0 | p a g e 7 3 o f 1 2 8 d u a l d a t a p o i n t e r s t h e a d e 7 5 1 8 i n c o r p o r a t e s t w o d a t a p o i n t e r s . t h e s e c o n d d a t a p o i n t e r i s a s h a d o w d a t a p o i n t e r a n d i s s e l e c t e d v i a t h e d a t a p o i n t e r c o n t r o l s f r ( d p c o n , 0 x a 7 ) . d p c o n f e a t u r e s a u t o m a t i c h a r d - w a r e p o s t i n c r e m e n t a n d p o s t d e c r e m e n t , a s w e l l a s a n a u t o m a t i c d a t a p o i n t e r t o g g l e . n o t e t h a t t h i s i s t h e o n l y s e c t i o n o f t h e d a t a s h e e t w h e r e t h e m a i n a n d s h a d o w d a t a p o i n t e r s a r e d i s t i n g u i s h e d . w h e n e v e r t h e d a t a p o i n t e r ( d p t r ) i s m e n t i o n e d e l s e w h e r e i n t h e d a t a s h e e t , a c t i v e d p t r i s i m p l i e d . i n a d d i t i o n , o n l y t h e m o v c / m o v x @ d p t r i n s t r u c t i o n s a u t o m a t i c a l l y p o s t i n c r e m e n t a n d p o s t d e c r e m e n t t h e d p t r . o t h e r m o v c / m o v x i n s t r u c t i o n s , s u c h a s m o v c p c o r m o v c @ r i , d o n o t c a u s e t h e d p t r t o a u t o m a t i c a l l y p o s t i n c r e m e n t a n d p o s t d e c r e m e n t . t o i l l u s t r a t e t h e o p e r a t i o n o f d p c o n , t h e f o l l o w i n g c o d e c o p i e s 2 5 6 b y t e s o f c o d e m e m o r y a t a d d r e s s 0 x d 0 0 0 i n t o x r a m , s t a r t i n g f r o m a d d r e s s 0 x 0 0 0 0 : m o v d p t r , # 0 ; m a i n d p t r = 0 m o v d p c o n , # 5 5 h ; s e l e c t s h a d o w d p t r ; d p t r 1 i n c r e m e n t m o d e ; d p t r 0 i n c r e m e n t m o d e ; d p t r a u t o t o g g l i n g o n m o v d p t r , # 0 d 0 0 0 h ; d p t r = d 0 0 0 h m o v e l o o p : c l r a m o v c a , @ a + d p t r ; g e t d a t a ; p o s t i n c d p t r ; s w a p t o m a i n d p t r ( d a t a ) m o v x @ d p t r , a ; p u t a c c i n x r a m ; i n c r e m e n t m a i n d p t r ; s w a p s h a d o w d p t r ( c o d e ) m o v a , d p l j n z m o v e l o o p t a b l e 5 6 . d a t a p o i n t e r c o n t r o l s f r ( d p c o n , 0 x a 7 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 n o t i m p l e m e n t e d . w r i t e d o n ? t c a r e . 6 d p t 0 d a t a p o i n t e r a u t o m a t i c t o g g l e e n a b l e . c l e a r e d b y t h e u s e r t o d i s a b l e a u t o s w a p p i n g o f t h e d p t r . s e t i n u s e r s o f t w a r e t o e n a b l e a u t o m a t i c t o g g l i n g o f t h e d p t r a f t e r e a c h m o v x o r m o v c i n s t r u c t i o n . 5 t o 4 d p 1 m 1 , d p 1 m 0 0 0 s h a d o w d a t a p o i n t e r m o d e . t h e s e b i t s e n a b l e e x t r a m o d e s o f t h e s h a d o w d a t a p o i n t e r o p e r a t i o n , a l l o w i n g m o r e c o m p a c t a n d m o r e e f f i c i e n t c o d e s i z e a n d e x e c u t i o n . d p 1 m 1 d p 1 m 0 r e s u l t ( b e h a v i o r o f t h e s h a d o w d a t a p o i n t e r ) 0 0 8 0 5 2 b e h a v i o r . 0 1 d p t r i s p o s t i n c r e m e n t e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . 1 0 d p t r i s p o s t d e c r e m e n t e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . 1 1 d p t r l s b i s t o g g l e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . t h i s i n s t r u c t i o n c a n b e u s e f u l f o r m o v i n g 8 - b i t b l o c k s t o / f r o m 1 6 - b i t d e v i c e s . 3 t o 2 d p 0 m 1 , d p 0 m 0 0 0 m a i n d a t a p o i n t e r m o d e . t h e s e b i t s e n a b l e e x t r a m o d e s o f t h e m a i n d a t a p o i n t e r o p e r a t i o n , a l l o w i n g m o r e c o m p a c t a n d m o r e e f f i c i e n t c o d e s i z e a n d e x e c u t i o n . d p 0 m 1 d p 0 m 0 r e s u l t ( b e h a v i o r o f t h e m a i n d a t a p o i n t e r ) 0 0 8 0 5 2 b e h a v i o r . 0 1 d p t r i s p o s t i n c r e m e n t e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . 1 0 d p t r i s p o s t d e c r e m e n t e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . 1 1 d p t r l s b i s t o g g l e d a f t e r a m o v x o r m o v c i n s t r u c t i o n . t h i s i n s t r u c t i o n i s u s e f u l f o r m o v i n g 8 - b i t b l o c k s t o / f r o m 1 6 - b i t d e v i c e s . 1 0 n o t i m p l e m e n t e d . w r i t e d o n ? t c a r e . 0 d p s e l 0 d a t a p o i n t e r s e l e c t . c l e a r e d b y t h e u s e r t o s e l e c t t h e m a i n d a t a p o i n t e r , m e a n i n g t h a t t h e c o n t e n t s o f t h i s 1 6 - b i t r e g i s t e r a r e p l a c e d i n t o t h e d p l s f r a n d d p h s f r . s e t b y t h e u s e r t o s e l e c t t h e s h a d o w d a t a p o i n t e r , m e a n i n g t h a t t h e c o n t e n t s o f a s e p a r a t e 1 6 - b i t r e g i s t e r a p p e a r i n t h e d p l s f r a n d d p h s f r .
a d e 7 5 1 8 r e v . 0 | p a g e 7 4 o f 1 2 8 i n t e r r u p t s y s t e m t h e u n i q u e p o w e r m a n a g e m e n t a r c h i t e c t u r e o f t h e a d e 7 5 1 8 i n c l u d e s a n o p e r a t i n g m o d e ( p s m 2 ) w h e r e t h e 8 0 5 2 m c u c o r e i s s h u t d o w n . e v e n t s c a n b e c o n f i g u r e d t o w a k e t h e 8 0 5 2 m c u c o r e f r o m t h e p s m 2 o p e r a t i n g m o d e . a d i s t i n c t i o n i s d r a w n h e r e b e t w e e n e v e n t s t h a t c a n t r i g g e r t h e w a k e - u p o f t h e 8 0 5 2 m c u c o r e a n d e v e n t s t h a t c a n t r i g g e r a n i n t e r r u p t w h e n t h e m c u c o r e i s a c t i v e . e v e n t s t h a t c a n w a k e t h e c o r e a r e r e f e r r e d t o a s w a k e - u p e v e n t s , w h e r e a s e v e n t s t h a t c a n i n t e r r u p t t h e p r o g r a m f l o w w h e n t h e m c u i s a c t i v e a r e c a l l e d i n t e r r u p t s . s e e t h e 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s s e c t i o n t o l e a r n m o r e a b o u t e v e n t s t h a t c a n w a k e t h e 8 0 5 2 c o r e f r o m p s m 2 . t h e a d e 7 5 1 8 p r o v i d e s 1 2 i n t e r r u p t s o u r c e s w i t h t h r e e p r i o r i t y l e v e l s . t h e p o w e r m a n a g e m e n t i n t e r r u p t i s a t t h e h i g h e s t p r i o r i t y l e v e l . t h e o t h e r t w o p r i o r i t y l e v e l s a r e c o n f i g u r a b l e t h r o u g h t h e i n t e r r u p t p r i o r i t y s f r ( i p , 0 x b 8 ) a n d t h e i n t e r r u p t e n a b l e a n d p r i o r i t y 2 s f r ( i e i p 2 , 0 x a 9 ) . s t a n d a r d 8 0 5 2 i n t e r r u p t a r c h i t e c t u r e t h e 8 0 5 2 s t a n d a r d i n t e r r u p t a r c h i t e c t u r e i n c l u d e s t w o t i e r s o f i n t e r r u p t s , w h e r e s o m e i n t e r r u p t s a r e a s s i g n e d a h i g h p r i o r i t y a n d o t h e r s a r e a s s i g n e d a l o w p r i o r i t y . p r i o r i t y 1 p r i o r i t y 0 h i g h l o w 0 7 3 2 7 - 0 7 3 f i g u r e 7 3 . s t a n d a r d 8 0 5 2 i n t e r r u p t p r i o r i t y l e v e l s a p r i o r i t y 1 i n t e r r u p t c a n i n t e r r u p t t h e s e r v i c e r o u t i n e o f a p r i o r i t y 0 i n t e r r u p t , a n d i f t w o i n t e r r u p t s o f d i f f e r e n t p r i o r i t i e s o c c u r a t t h e s a m e t i m e , t h e p r i o r i t y 1 i n t e r r u p t i s s e r v i c e d f i r s t . a n i n t e r r u p t c a n n o t b e i n t e r r u p t e d b y a n o t h e r i n t e r r u p t o f t h e s a m e p r i o r i t y l e v e l . i f t w o i n t e r r u p t s o f t h e s a m e p r i o r i t y l e v e l o c c u r s i m u l t a n e o u s l y , a p o l l i n g s e q u e n c e i s o b s e r v e d ( s e e t h e i n t e r r u p t p r i o r i t y s e c t i o n ) . i n t e r r u p t a r c h i t e c t u r e t h e a d e 7 5 1 8 p o s s e s s e s a d v a n c e d p o w e r s u p p l y m a n a g m e n t f e a t u r e s . t o e n s u r e a f a s t r e s p o n s e t o t i m e - c r i t i c a l p o w e r s u p p l y i s s u e s , s u c h a s a l o s s o f l i n e p o w e r , t h e p o w e r s u p p l y m a n a g m e n t i n t e r r u p t s h o u l d b e a b l e t o i n t e r r u p t a n y i n t e r r u p t s e r v i c e r o u t i n e . t o e n a b l e t h e u s e r t o h a v e f u l l u s e o f t h e s t a n d a r d 8 0 5 2 i n t e r r u p t p r i o r i t y l e v e l s , a n a d d i t i o n a l p r i o r i t y l e v e l i s a d d e d f o r t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t . t h e p s m i n t e r r u p t i s t h e o n l y i n t e r r u p t a t t h i s h i g h e s t i n t e r r u p t p r i o r i t y l e v e l . p r i o r i t y 1 p r i o r i t y 0 p s m h i g h l o w 0 7 3 2 7 - 0 7 4 f i g u r e 7 4 . i n t e r r u p t a r c h i t e c t u r e s e e t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t s e c t i o n f o r m o r e i n f o r m a t i o n o n t h e p s m i n t e r r u p t . i n t e r r u p t r e g i s t e r s t h e c o n t r o l a n d c o n f i g u r a t i o n o f t h e i n t e r r u p t s y s t e m i s c a r r i e d o u t t h r o u g h f o u r i n t e r r u p t - r e l a t e d s f r s d i s c u s s e d i n t h i s s e c t i o n . t a b l e 5 7 . i n t e r r u p t s f r s s f r a d d r e s s d e f a u l t b i t a d d r e s s a b l e d e s c r i p t i o n i e 0 x a 8 0 x 0 0 y e s i n t e r r u p t e n a b l e ( s e e t a b l e 5 8 ) . i p 0 x b 8 0 x 0 0 y e s i n t e r r u p t p r i o r i t y ( s e e t a b l e 5 9 ) . i e i p 2 0 x a 9 0 x a 0 n o i n t e r r u p t e n a b l e a n d p r i o r i t y 2 ( s e e t a b l e 6 0 ) . w d c o n 0 x c 0 0 x 1 0 y e s w a t c h d o g t i m e r ( s e e t a b l e 6 5 a n d t h e w r i t i n g t o t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) s e c t i o n ) . t a b l e 5 8 . i n t e r r u p t e n a b l e s f r ( i e , 0 x a 8 ) b i t a d d r e s s m n e m o n i c d e s c r i p t i o n 7 0 x a f e a e n a b l e s a l l i n t e r r u p t s o u r c e s . s e t b y t h e u s e r . c l e a r e d b y t h e u s e r t o d i s a b l e a l l i n t e r r u p t s o u r c e s . 6 0 x a e r e s e r v e d t h i s b i t s h o u l d b e l e f t c l e a r e d f o r p r o p e r o p e r a t i o n . 5 0 x a d e t 2 e n a b l e s t h e t i m e r 2 i n t e r r u p t . s e t b y t h e u s e r . 4 0 x a c e s e n a b l e s t h e u a r t s e r i a l p o r t i n t e r r u p t . s e t b y t h e u s e r . 3 0 x a b e t 1 e n a b l e s t h e t i m e r 1 i n t e r r u p t . s e t b y t h e u s e r . 2 0 x a a e x 1 e n a b l e s t h e e x t e r n a l i n t e r r u p t 1 ( i n t 1 ) . s e t b y t h e u s e r . 1 0 x a 9 e t 0 e n a b l e s t h e t i m e r 0 i n t e r r u p t . s e t b y t h e u s e r . 0 0 x a 8 e x 0 e n a b l e s e x t e r n a l i n t e r r u p t 0 ( i n t 0 ) . s e t b y t h e u s e r .
a d e 7 5 1 8 r e v . 0 | p a g e 7 5 o f 1 2 8 t a b l e 5 9 . i n t e r r u p t p r i o r i t y s f r ( i p , 0 x b 8 ) b i t a d d r e s s m n e m o n i c d e s c r i p t i o n 7 0 x b f p a d e a d e e n e r g y m e a s u r e m e n t i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 6 0 x b e r e s e r v e d t h i s b i t s h o u l d b e l e f t c l e a r e d f o r p r o p e r o p e r a t i o n . 5 0 x b d p t 2 t i m e r 2 i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 4 0 x b c p s u a r t s e r i a l p o r t i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 3 0 x b b p t 1 t i m e r 1 i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 2 0 x b a p x 1 i n t 1 ( e x t e r n a l i n t e r r u p t 1 ) p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 1 0 x b 9 p t 0 t i m e r 0 i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 0 0 x b 8 p x 0 i n t 0 ( e x t e r n a l i n t e r r u p t 0 ) p r i o r i t y ( 1 = h i g h , 0 = l o w ) . t a b l e 6 0 . i n t e r r u p t e n a b l e a n d p r i o r i t y 2 s f r ( i e i p 2 , 0 x a 9 ) b i t m n e m o n i c d e s c r i p t i o n 7 r e s e r v e d r e s e r v e d . 6 p t i r t c i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 5 r e s e r v e d r e s e r v e d . 4 p s i s p i / i 2 c i n t e r r u p t p r i o r i t y ( 1 = h i g h , 0 = l o w ) . 3 e a d e e n a b l e s t h e e n e r g y m e t e r i n g i n t e r r u p t ( a d e ) . s e t b y t h e u s e r . 2 e t i e n a b l e s t h e r t c i n t e r v a l t i m e r i n t e r r u p t . s e t b y t h e u s e r . 1 e p s m e n a b l e s t h e p s m p o w e r s u p p l y m a n a g e m e n t i n t e r r u p t . s e t b y t h e u s e r . 0 e s i e n a b l e s t h e s p i / i 2 c i n t e r r u p t . s e t b y t h e u s e r . i n t e r r u p t p r i o r i t y i f t w o i n t e r r u p t s o f t h e s a m e p r i o r i t y l e v e l o c c u r s i m u l t a n e o u s l y , t h e p o l l i n g s e q u e n c e i s o b s e r v e d ( a s s h o w n i n t a b l e 6 1 ) . t a b l e 6 1 . p r i o r i t y w i t h i n i n t e r r u p t l e v e l s o u r c e p r i o r i t y d e s c r i p t i o n i p s m 0 ( h i g h e s t ) p o w e r s u p p l y m a n a g e m e n t i n t e r r u p t . i r t c 1 r t c i n t e r v a l t i m e r i n t e r r u p t . i a d e 2 a d e e n e r g y m e a s u r e m e n t i n t e r r u p t . w d t 3 w a t c h d o g t i m e r o v e r f l o w i n t e r r u p t . i e 0 4 e x t e r n a l i n t e r r u p t 0 . t f 0 5 t i m e r / c o u n t e r 0 i n t e r r u p t . i e 1 6 e x t e r n a l i n t e r r u p t 1 . t f 1 7 t i m e r / c o u n t e r 1 i n t e r r u p t . i s p i / i 2 c i 8 s p i / i 2 c i n t e r r u p t . r i / t i 9 u a r t s e r i a l p o r t i n t e r r u p t . t f 2 / e x f 2 1 0 ( l o w e s t ) t i m e r / c o u n t e r 2 i n t e r r u p t .
a d e 7 5 1 8 r e v . 0 | p a g e 7 6 o f 1 2 8 i n t e r r u p t f l a g s t h e i n t e r r u p t f l a g s a n d s t a t u s f l a g s a s s o c i a t e d w i t h t h e i n t e r r u p t v e c t o r s a r e s h o w n i n t a b l e 6 2 a n d t a b l e 6 3 . m o s t o f t h e i n t e r r u p t s h a v e f l a g s a s s o c i a t e d w i t h t h e m . t a b l e 6 2 . i n t e r r u p t f l a g s i n t e r r u p t s o u r c e f l a g b i t n a m e d e s c r i p t i o n i e 0 t c o n . 1 i e 0 e x t e r n a l i n t e r r u p t 0 . t f 0 t c o n . 5 t f 0 t i m e r 0 . i e 1 t c o n . 3 i e 1 e x t e r n a l i n t e r r u p t 1 . t f 1 t c o n . 7 t f 1 t i m e r 1 . r i + t i s c o n . 1 t i t r a n s m i t i n t e r r u p t . s c o n . 0 r i r e c e i v e i n t e r r u p t . t f 2 + e x f 2 t 2 c o n . 7 t f 2 t i m e r 2 o v e r f l o w f l a g . t 2 c o n . 6 e x f 2 t i m e r 2 e x t e r n a l f l a g . i p s m ( p o w e r s u p p l y ) i p s m f . 6 f p s m p s m i n t e r r u p t f l a g . i a d e ( e n e r g y m e a s u r e m e n t d s p ) m i r q s t l . 7 a d e i r q f l a g r e a d m i r q s t h , m i r q s t m , m i r q s t l . t a b l e 6 3 . s t a t u s f l a g s i n t e r r u p t s o u r c e f l a g b i t n a m e d e s c r i p t i o n i s p i / i 2 c i s p i 2 c s t a t 1 n / a s p i i n t e r r u p t s t a t u s r e g i s t e r . s p i 2 c s t a t 1 n / a i 2 c i n t e r r u p t s t a t u s r e g i s t e r . i r t c ( r t c i n t e r v a l t i m e r ) t i m e c o n . 7 m i d n i g h t r t c m i d n i g h t f l a g . t i m e c o n . 2 a l a r m r t c a l a r m f l a g . w d t ( w a t c h d o g t i m e r ) w d c o n . 2 w d s w a t c h d o g t i m e o u t f l a g . 1 t h e r e i s n o s p e c i f i c f l a g f o r i s p i / i 2 c i ; h o w e v e r , a l l f l a g s f o r s p i 2 c s t a t n e e d t o b e r e a d t o a s s e s s t h e r e a s o n f o r t h e i n t e r r u p t . a f u n c t i o n a l b l o c k d i a g r a m o f t h e i n t e r r u p t s y s t e m i s s h o w n i n f i g u r e 7 5 . n o t e t h a t t h e p s m i n t e r r u p t i s t h e o n l y i n t e r r u p t i n t h e h i g h e s t p r i o r i t y l e v e l . i f a n e x t e r n a l w a k e - u p e v e n t o c c u r s t o w a k e t h e a d e 7 5 1 8 f r o m p s m 2 , a p e n d i n g e x t e r n a l i n t e r r u p t i s g e n e r a t e d . w h e n t h e e x 0 o r e x 1 b i t i n t h e i n t e r r u p t e n a b l e s f r ( i e , 0 x a 8 ) i s s e t t o e n a b l e e x t e r n a l i n t e r r u p t s , t h e p r o g r a m c o u n t e r i s l o a d e d w i t h t h e i e 0 o r i e 1 i n t e r r u p t v e c t o r . t h e i e 0 a n d i e 1 i n t e r r u p t f l a g s i n t h e t c o n r e g i s t e r a r e n o t a f f e c t e d b y e v e n t s t h a t o c c u r w h e n t h e 8 0 5 2 m c u c o r e i s s h u t d o w n d u r i n g p s m 2 . s e e t h e p o w e r s u p p l y m a n a g e m e n t ( p s m ) i n t e r r u p t s e c t i o n . t h e r t c a n d i 2 c / s p i i n t e r r u p t s a r e l a t c h e d s u c h t h a t p e n d i n g i n t e r r u p t s c a n n o t b e c l e a r e d w i t h o u t e n t e r i n g t h e i r r e s p e c t i v e i n t e r r u p t s e r v i c e r o u t i n e s . c l e a r i n g t h e r t c m i d n i g h t f l a g s a n d a l a r m f l a g s d o e s n o t c l e a r a p e n d i n g r t c i n t e r r u p t . s i m i l a r l y , c l e a r i n g t h e i 2 c / s p i s t a t u s b i t s i n t h e s p i i n t e r r u p t s t a t u s s f r ( s p i s t a t , 0 x e a ) d o e s n o t c a n c e l a p e n d i n g i 2 c / s p i i n t e r r u p t . t h e s e i n t e r r u p t s r e m a i n p e n d i n g u n t i l t h e r t c o r i 2 c / s p i i n t e r r u p t v e c t o r s a r e e n a b l e d . t h e i r r e s p e c t i v e i n t e r r u p t s e r v i c e r o u t i n e s a r e e n t e r e d s h o r t l y t h e r e a f t e r . f i g u r e 7 5 s h o w s h o w t h e i n t e r r u p t s a r e c l e a r e d w h e n t h e i n t e r r u p t s e r v i c e r o u t i n e s a r e e n t e r e d . s o m e i n t e r r u p t s w i t h m u l t i p l e i n t e r r u p t s o u r c e s a r e n o t a u t o m a t i c a l l y c l e a r e d ; s p e c i f i c a l l y , t h e p s m , a d e , u a r t , a n d t i m e r 2 i n t e r r u p t v e c t o r s . n o t e t h a t t h e i n t 0 a n d i n t 1 i n t e r r u p t s a r e o n l y c l e a r e d i f t h e e x t e r n a l i n t e r r u p t i s c o n f i g u r e d t o b e t r i g g e r e d b y a f a l l i n g e d g e b y s e t t i n g i t 0 i n t h e t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 c o n t r o l s f r ( t c o n , 0 x 8 8 ) . i f i n t 0 o r i n t 1 i s c o n f i g u r e d t o i n t e r r u p t o n a l o w l e v e l , t h e i n t e r r u p t s e r v i c e r o u t i n e i s r e - e n t e r e d u n t i l t h e r e s p e c t i v e p i n g o e s h i g h .
a d e 7 5 1 8 r e v . 0 | p a g e 7 7 o f 1 2 8 i p s m f f p s m ( i p s m f . 6 ) i p s m e i n d i v i d u a l i n t e r r u p t e n a b l e i e / i e i p 2 r e g i s t e r s i p / i e i p 2 r e g i s t e r s w a t c h d o g t i m e o u t w d i r l o w h i g h h i g h e s t m i d n i g h t a l a r m m i r q s t h m i r q s t m m i r q s t l m i r q e n h m i r q e n m m i r q e n l m i r q s t l . 7 i n t 0 i t 0 0 1 i e 0 t f 0 i n t 1 i t 1 0 1 t f 1 c f g . 5 0 1 i 2 c i n t e r r u p t s p i i n t e r r u p t r i t i t f 2 e x f 2 i n t e r r u p t p o l l i n g s e q u e n c e p s m r t c a d e w a t c h d o g e x t e r n a l i n t e r r u p t 0 t i m e r 0 e x t e r n a l i n t e r r u p t 1 t i m e r 1 i 2 c / s p i u a r t t i m e r 2 a u t o m a t i c c l e a r s i g n a l l e g e n d i t 0 i e 1 i t 1 p s m 2 p s m 2 p r i o r i t y l e v e l g l o b a l i n t e r r u p t e n a b l e ( e a ) i n / o u t l a t c h r e s e t 0 7 3 2 7 - 0 7 5 i n / o u t l a t c h r e s e t f i g u r e 7 5 . i n t e r r u p t s y s t e m f u n c t i o n a l b l o c k d i a g r a m
a d e 7 5 1 8 r e v . 0 | p a g e 7 8 o f 1 2 8 i n t e r r u p t v e c t o r s w h e n a n i n t e r r u p t o c c u r s , t h e p r o g r a m c o u n t e r i s p u s h e d o n t o t h e s t a c k , a n d t h e c o r r e s p o n d i n g i n t e r r u p t v e c t o r a d d r e s s i s l o a d e d i n t o t h e p r o g r a m c o u n t e r . w h e n t h e i n t e r r u p t s e r v i c e r o u t i n e i s c o m p l e t e , t h e p r o g r a m c o u n t e r i s p o p p e d o f f t h e s t a c k b y a r e t i i n s t r u c t i o n . t h i s a l l o w s p r o g r a m e x e c u t i o n t o r e s u m e f r o m w h e r e i t w a s i n t e r r u p t e d . t h e i n t e r r u p t v e c t o r a d d r e s s e s a r e s h o w n i n t a b l e 6 4 . t a b l e 6 4 . i n t e r r u p t v e c t o r a d d r e s s e s s o u r c e v e c t o r a d d r e s s i e 0 0 x 0 0 0 3 t f 0 0 x 0 0 0 b i e 1 0 x 0 0 1 3 t f 1 0 x 0 0 1 b r i + t i 0 x 0 0 2 3 t f 2 + e x f 2 0 x 0 0 2 b r e s e r v e d 0 x 0 0 3 3 i s p i / i 2 c i 0 x 0 0 3 b i p s m ( p o w e r s u p p l y ) 0 x 0 0 4 3 i a d e ( e n e r g y m e a s u r e m e n t d s p ) 0 x 0 0 4 b i r t c ( r t c i n t e r v a l t i m e r ) 0 x 0 0 5 3 w d t ( w a t c h d o g t i m e r ) 0 x 0 0 5 b i n t e r r u p t l a t e n c y t h e 8 0 5 2 a r c h i t e c t u r e r e q u i r e s t h a t a t l e a s t o n e i n s t r u c t i o n e x e c u t e s b e t w e e n i n t e r r u p t s . t o e n s u r e t h i s , t h e 8 0 5 2 m c u c o r e h a r d w a r e p r e v e n t s t h e p r o g r a m c o u n t e r f r o m j u m p i n g t o a n i s r i m m e d i a t e l y a f t e r c o m p l e t i n g a n r e t i i n s t r u c t i o n o r a n a c c e s s o f t h e i p a n d i e r e g i s t e r s . t h e s h o r t e s t i n t e r r u p t l a t e n c y i s 3 . 2 5 i n s t r u c t i o n c y c l e s , 8 0 0 n s w i t h a c l o c k o f 4 . 0 9 6 m h z . t h e l o n g e s t i n t e r r u p t l a t e n c y f o r a h i g h p r i o r i t y i n t e r r u p t r e s u l t s w h e n a p e n d i n g i n t e r r u p t i s g e n e r a t e d d u r i n g a l o w p r i o r i t y i n t e r r u p t r e t i , f o l l o w e d b y a m u l t i p l y i n s t r u c t i o n . t h i s r e s u l t s i n a m a x i m u m i n t e r r u p t l a t e n c y o f 1 6 . 2 5 i n s t r u c t i o n c y c l e s , 4 s w i t h a c l o c k o f 4 . 0 9 6 m h z . c o n t e x t s a v i n g w h e n t h e 8 0 5 2 v e c t o r s t o a n i n t e r r u p t , o n l y t h e p r o g r a m c o u n t e r i s s a v e d o n t h e s t a c k . t h e r e f o r e , t h e i n t e r r u p t s e r v i c e r o u t i n e m u s t b e w r i t t e n t o e n s u r e t h a t r e g i s t e r s u s e d i n t h e m a i n p r o g r a m a r e r e s t o r e d t o t h e i r p r e i n t e r r u p t s t a t e . c o m m o n r e g i s t e r s t h a t c a n b e m o d i f i e d i n t h e i s r a r e t h e a c c u m u l a t o r r e g i s t e r a n d t h e p s w r e g i s t e r . a n y g e n e r a l - p u r p o s e r e g i s t e r s t h a t a r e u s e d a s s c r a t c h p a d s i n t h e i s r s h o u l d a l s o b e r e s t o r e d b e f o r e e x i t i n g t h e i n t e r r u p t . t h e f o l l o w i n g e x a m p l e 8 0 5 2 c o d e s h o w s h o w t o r e s t o r e s o m e c o m m o n l y u s e d r e g i s t e r s : g e n e r a l i s r : ; s a v e t h e c u r r e n t a c c u m u l a t o r v a l u e p u s h a c c ; s a v e t h e c u r r e n t s t a t u s a n d r e g i s t e r b a n k s e l e c t i o n p u s h p s w ; s e r v i c e i n t e r r u p t ?; r e s t o r e t h e s t a t u s a n d r e g i s t e r b a n k s e l e c t i o n p o p p s w ; r e s t o r e t h e a c c u m u l a t o r p o p a c c r e t i
a d e 7 5 1 8 r e v . 0 | p a g e 7 9 o f 1 2 8 w a t c h d o g t i m e r t h e w a t c h d o g t i m e r g e n e r a t e s a d e v i c e r e s e t o r i n t e r r u p t w i t h i n a r e a s o n a b l e a m o u n t o f t i m e i f t h e a d e 7 5 1 8 e n t e r s a n e r r o n e o u s s t a t e , p o s s i b l y d u e t o a p r o g r a m m i n g e r r o r o r e l e c t r i c a l n o i s e . t h e w a t c h d o g i s e n a b l e d b y d e f a u l t w i t h a t i m e o u t o f t w o s e c o n d s a n d c r e a t e s a s y s t e m r e s e t i f n o t c l e a r e d w i t h i n t w o s e c o n d s . t h e w a t c h d o g f u n c t i o n c a n b e d i s a b l e d b y c l e a r i n g t h e w a t c h d o g e n a b l e b i t ( w d e ) i n t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) . t h e w a t c h d o g c i r c u i t g e n e r a t e s a s y s t e m r e s e t o r i n t e r r u p t ( w d s ) i f t h e u s e r p r o g r a m f a i l s t o s e t t h e w d e b i t w i t h i n a p r e d e t e r - m i n e d a m o u n t o f t i m e ( s e t b y p r e [ 3 : 0 ] ) . t h e w a t c h d o g t i m e r i s c l o c k e d f r o m t h e 3 2 . 7 6 8 k h z e x t e r n a l c r y s t a l c o n n e c t e d b e t w e e n t h e x t a l 1 a n d x t a l 2 p i n s . t h e w d c o n s f r c a n b e w r i t t e n o n l y b y u s e r s o f t w a r e i f t h e d o u b l e w r i t e s e q u e n c e d e s c r i b e d i n t h e w r i t i n g t o t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) s e c t i o n i s i n i t i a t e d o n e v e r y w r i t e a c c e s s t o t h e w d c o n s f r . t o p r e v e n t a n y c o d e f r o m i n a d v e r t e n t l y d i s a b l i n g t h e w a t c h d o g , a w a t c h d o g p r o t e c t i o n c a n b e a c t i v a t e d . t h i s w a t c h d o g p r o t e c t i o n l o c k s i n t h e w a t c h d o g e n a b l e a n d e v e n t s e t t i n g s s o t h a t t h e y c a n n o t b e c h a n g e d b y u s e r c o d e . t h e p r o t e c t i o n i s a c t i v a t e d b y c l e a r i n g a w a t c h d o g p r o t e c t i o n b i t i n t h e f l a s h m e m o r y . t h e w a t c h d o g p r o t e c t i o n b i t i s t h e m o s t s i g n i f i c a n t b i t a t a d d r e s s 0 x 3 f f a o f t h e f l a s h m e m o r y . w h e n t h i s b i t i s c l e a r e d , t h e w d i r b i t i s f o r c e d t o 0 , a n d t h e w d e b i t i s f o r c e d t o 1 . n o t e t h a t t h e s e q u e n c e f o r c o n f i g u r i n g t h e f l a s h p r o t e c t i o n b i t s m u s t b e f o l l o w e d t o m o d i f y t h e w a t c h d o g p r o t e c t i o n b i t a t a d d r e s s 0 x 3 f f a ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . t a b l e 6 5 . w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 4 0 x c 7 t o 0 x c 4 p r e [ 3 : 0 ] 7 w a t c h d o g p r e s c a l e r . i n n o r m a l m o d e , t h e 1 6 - b i t w a t c h d o g t i m e r i s c l o c k e d b y t h e i n p u t c l o c k ( 3 2 . 7 6 8 k h z ) . t h e p r e x b i t s s e t w h i c h o f t h e u p p e r b i t s o f t h e c o u n t e r a r e u s e d a s t h e w a t c h d o g o u t p u t , a s f o l l o w s : 1 2 2 9 x t a l t p r e w a t c h d o g u p r e [ 3 : 0 ] r e s u l t ( w a t c h d o g t i m e o u t ) 0 0 0 0 1 5 . 6 m s 0 0 0 1 3 1 . 2 m s 0 0 1 0 6 2 . 5 m s 0 0 1 1 1 2 5 m s 0 1 0 0 2 5 0 m s 0 1 0 1 5 0 0 m s 0 1 1 0 1 s e c 0 1 1 1 2 s e c 1 0 0 0 0 s e c , a u t o m a t i c r e s e t 1 0 0 1 0 s e c , s e r i a l d o w n l o a d r e s e t 1 0 1 0 t o 1 1 1 1 n o t a v a l i d s e l e c t i o n 3 0 x c 3 w d i r 0 w a t c h d o g i n t e r r u p t r e s p o n s e b i t . w h e n c l e a r e d , t h e w a t c h d o g g e n e r a t e s a s y s t e m r e s e t w h e n t h e w a t c h d o g t i m e o u t p e r i o d h a s e x p i r e d . w h e n s e t , t h e w a t c h d o g g e n e r a t e s a n i n t e r r u p t w h e n t h e w a t c h d o g t i m e o u t p e r i o d h a s e x p i r e d . 2 0 x c 2 w d s 0 w a t c h d o g s t a t u s b i t . t h i s b i t i s s e t t o i n d i c a t e t h a t a w a t c h d o g t i m e o u t h a s o c c u r r e d . i t i s c l e a r e d b y w r i t i n g a 0 o r b y a n e x t e r n a l h a r d w a r e r e s e t . a w a t c h d o g r e s e t d o e s n o t c l e a r w d s ; t h e r e f o r e , i t c a n b e u s e d t o d i s t i n g u i s h b e t w e e n a w a t c h d o g r e s e t a n d a h a r d w a r e r e s e t f r o m t h e r e s e t p i n . 1 0 x c 1 w d e 1 w a t c h d o g e n a b l e b i t . w h e n s e t , t h i s b i t e n a b l e s t h e w a t c h d o g a n d c l e a r s i t s c o u n t e r . t h e w a t c h d o g c o u n t e r i s s u b s e q u e n t l y c l e a r e d a g a i n w h e n e v e r w d e i s s e t . i f t h e w a t c h d o g i s n o t c l e a r e d w i t h i n i t s s e l e c t e d t i m e o u t p e r i o d , i t g e n e r a t e s a s y s t e m r e s e t o r w a t c h d o g i n t e r r u p t , d e p e n d i n g o n t h e w d i r b i t . 0 0 x c 0 w d w r 0 w a t c h d o g w r i t e e n a b l e b i t . s e e t h e w r i t i n g t o t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) s e c t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 8 0 o f 1 2 8 t a b l e 6 6 . w a t c h d o g a n d f l a s h p r o t e c t i o n b y t e i n f l a s h ( f l a s h a d d r e s s = 0 x 3 f f a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 w d p r o t _ p r o t k y 7 1 t h i s b i t h o l d s t h e p r o t e c t i o n f o r t h e w a t c h d o g t i m e r a n d t h e s e v e n t h b i t o f t h e f l a s h p r o t e c t i o n k e y . w h e n t h i s b i t i s c l e a r e d , t h e w a t c h d o g e n a b l e ( w d e ) a n d i n t e r r u p t r e s p o n s e b i t s ( w d i r ) c a n n o t b e c h a n g e d b y u s e r c o d e . t h e w a t c h d o g c o n f i g u r a t i o n i s t h e n f i x e d t o w d i r = 0 a n d w d e = 1 . t h e w a t c h d o g t i m e o u t i n p r e [ 3 : 0 ] c a n s t i l l b e m o d i f i e d b y u s e r c o d e . t h e v a l u e o f t h i s b i t i s a l s o u s e d t o s e t t h e f l a s h p r o t e c t i o n k e y . i f t h i s b i t i s c l e a r e d t o p r o t e c t t h e w a t c h d o g , t h e n t h e d e f a u l t v a l u e f o r t h e f l a s h p r o t e c t i o n k e y i s 0 x 7 f i n s t e a d o f 0 x f f ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n f o r m o r e i n f o r m a t i o n o n h o w t o c l e a r t h i s b i t ) . 6 t o 0 p r o t k y [ 6 : 0 ] 0 x f f t h e s e b i t s h o l d t h e f l a s h p r o t e c t i o n k e y . t h e c o n t e n t o f t h i s f l a s h a d d r e s s i s c o m p a r e d t o t h e f l a s h p r o t e c t i o n k e y s f r ( p r o t k y , 0 x b b ) w h e n t h e p r o t e c t i o n i s b e i n g s e t o r c h a n g e d . i f t h e t w o v a l u e s m a t c h , t h e n e w p r o t e c t i o n i s w r i t t e n t o f l a s h a d d r e s s 0 x 3 f f f t o f l a s h a d d r e s s 0 x 3 f f b . s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n f o r m o r e i n f o r m a t i o n o n h o w t o c o n f i g u r e t h e s e b i t s . w r i t i n g t o t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) w r i t i n g d a t a t o t h e w d c o n s f r i n v o l v e s a d o u b l e i n s t r u c t i o n s e q u e n c e . t h e w d w r b i t m u s t b e s e t a n d t h e f o l l o w i n g i n s t r u c t i o n m u s t b e a w r i t e i n s t r u c t i o n t o t h e w d c o n s f r . d i s a b l e w a t c h d o g c l r e a s e t b w d w r c l r w d e s e t b e a t h i s s e q u e n c e i s n e c e s s a r y t o p r o t e c t t h e w d c o n s f r f r o m c o d e e x e c u t i o n u p s e t s t h a t m a y u n i n t e n t i o n a l l y m o d i f y t h i s s f r . i n t e r r u p t s s h o u l d b e d i s a b l e d d u r i n g t h i s o p e r a t i o n d u e t o t h e c o n s e c u t i v e i n s t r u c t i o n c y c l e s . w a t c h d o g t i m e r i n t e r r u p t i f t h e w a t c h d o g t i m e r i s n o t c l e a r e d w i t h i n t h e w a t c h d o g t i m e o u t p e r i o d , a s y s t e m r e s e t o c c u r s u n l e s s t h e w a t c h d o g t i m e r i n t e r r u p t i s e n a b l e d . t h e w a t c h d o g t i m e r i n t e r r u p t e n a b l e b i t ( w d i r ) i s l o c a t e d i n t h e w a t c h d o g t i m e r s f r ( w d c o n , 0 x c 0 ) . e n a b l i n g t h e w d i r b i t a l l o w s t h e p r o g r a m t o e x a m i n e t h e s t a c k o r o t h e r v a r i a b l e s t h a t m a y h a v e l e d t h e p r o g r a m t o e x e c u t e i n a p p r o p r i a t e c o d e . t h e w a t c h d o g t i m e r i n t e r r u p t a l s o a l l o w s t h e w a t c h d o g t o b e u s e d a s a l o n g i n t e r v a l t i m e r . n o t e t h a t w d i r i s a u t o m a t i c a l l y c o n f i g u r e d a s a h i g h p r i o r i t y i n t e r r u p t . t h i s i n t e r r u p t c a n n o t b e d i s a b l e d b y t h e e a b i t i n t h e i e r e g i s t e r ( s e e t a b l e 5 8 ) . e v e n i f a l l o f t h e o t h e r i n t e r r u p t s a r e d i s a b l e d , t h e w a t c h d o g i s k e p t a c t i v e t o w a t c h o v e r t h e p r o g r a m .
a d e 7 5 1 8 r e v . 0 | p a g e 8 1 o f 1 2 8 l c d d r i v e r u s i n g s h a r e d p i n s , t h e l c d m o d u l e i s c a p a b l e o f d i r e c t l y d r i v i n g a n l c d p a n e l o f 1 7 4 s e g m e n t s w i t h o u t c o m p r o m i s i n g a n y a d e 7 5 1 8 f u n c t i o n s . i t i s c a p a b l e o f d r i v i n g l c d s w i t h 2 , 3 , a n d 4 m u l t i p l e x i n g . t h e l c d w a v e f o r m v o l t a g e s a r e g e n e r a t e d t h r o u g h a n e x t e r n a l r e s i s t o r l a d d e r . e a c h a d e 7 5 1 8 h a s a n e m b e d d e d l c d c o n t r o l c i r c u i t , d r i v e r , a n d p o w e r s u p p l y c i r c u i t . t h e l c d m o d u l e i s f u n c t i o n a l i n a l l o p e r a t - i n g m o d e s ( s e e t h e o p e r a t i n g m o d e s s e c t i o n ) . l c d r e g i s t e r s t h e r e a r e s i x l c d c o n t r o l r e g i s t e r s t h a t c o n f i g u r e t h e d r i v e r f o r t h e s p e c i f i c t y p e o f l c d i n t h e e n d s y s t e m a n d s e t u p t h e u s e r d i s p l a y p r e f e r e n c e s . t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) , t h e l c d c o n f i g u r a t i o n x s f r ( l c d c o n x , 0 x 9 c ) , a n d t h e l c d c o n f i g u r a t i o n y s f r ( l c d c o n y , 0 x b 1 ) c o n t a i n g e n e r a l l c d d r i v e r c o n f i g u r a t i o n i n f o r m a t i o n , i n c l u d i n g t h e l c d e n a b l e a n d r e s e t , a s w e l l a s t h e m e t h o d o f l c d v o l t a g e g e n e r a t i o n a n d m u l t i p l e x l e v e l . t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) c o n f i g u r e s t i m i n g s e t t i n g s f o r l c d f r a m e r a t e a n d b l i n k r a t e . l c d p i n s a r e c o n f i g u r e d f o r l c d f u n c t i o n a l i t y i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) a n d t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . t a b l e 6 7 . l c d d r i v e r s f r s s f r a d d r e s s m n e m o n i c r / w d e s c r i p t i o n 0 x 9 5 l c d c o n r / w l c d c o n f i g u r a t i o n ( s e e t a b l e 6 8 ) . 0 x 9 6 l c d c l k r / w l c d c l o c k ( s e e t a b l e 7 1 ) . 0 x 9 7 l c d s e g e r / w l c d s e g m e n t e n a b l e ( s e e t a b l e 7 4 ) . 0 x 9 c l c d c o n x r / w l c d c o n f i g u r a t i o n x ( s e e t a b l e 6 9 ) . 0 x a c l c d p t r r / w l c d p o i n t e r ( s e e t a b l e 7 5 ) . 0 x a e l c d d a t r / w l c d d a t a ( s e e t a b l e 7 6 ) . 0 x b 1 l c d c o n y r / w l c d c o n f i g u r a t i o n y ( s e e t a b l e 7 0 ) . 0 x e d l c d s e g e 2 r / w l c d s e g m e n t e n a b l e 2 ( s e e t a b l e 7 7 ) . t a b l e 6 8 . l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 l c d e n 0 l c d e n a b l e . i f t h i s b i t i s s e t , t h e l c d d r i v e r i s e n a b l e d . 6 l c d r s t 0 l c d d a t a r e g i s t e r s r e s e t . i f t h i s b i t i s s e t , t h e l c d d a t a r e g i s t e r s a r e r e s e t t o z e r o . 5 b l i n k e n 0 b l i n k m o d e e n a b l e b i t . i f t h i s b i t i s s e t , b l i n k m o d e i s e n a b l e d . t h e b l i n k m o d e i s c o n f i g u r e d b y t h e b l k m o d [ 1 : 0 ] a n d b l k f r e q [ 1 : 0 ] b i t s i n t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) . 4 l c d p s m 2 0 f o r c e s l c d o f f w h e n i n p s m 2 ( s l e e p m o d e ) . l c d p s m 2 r e s u l t 0 t h e l c d i s d i s a b l e d o r e n a b l e d i n p s m 2 b y t h e l c d e n b i t . 1 t h e l c d i s d i s a b l e d i n p s m 2 r e g a r d l e s s o f l c d e n s e t t i n g . 3 c l k s e l 0 l c d c l o c k s e l e c t i o n . c l k s e l r e s u l t 0 f l c d c l k = 2 0 4 8 h z . 1 f l c d c l k = 1 2 8 h z . 2 b i a s 0 b i a s m o d e . b i a s r e s u l t 0 1 / 2 . i n t h i s m o d e , l c d v a i s i n t e r n a l l y c o n n e c t e d t o l c d v b ( s e e f i g u r e 7 6 ) . 1 1 / 3 ( s e e f i g u r e 7 7 ) . 1 t o 0 l m u x [ 1 : 0 ] 0 0 l c d m u l t i p l e x l e v e l . l m u x [ 1 : 0 ] r e s u l t 0 0 r e s e r v e d . 0 1 2 m u l t i p l e x i n g . f p 2 7 / c o m 3 i s u s e d a s f p 2 7 . f p 2 8 / c o m 2 i s u s e d a s f p 2 8 . 1 0 3 m u l i t p l e x i n g . f p 2 7 / c o m 3 i s u s e d a s f p 2 7 . f p 2 8 / c o m 2 i s u s e d a s c o m 2 . 1 1 4 m u l t i p l e x i n g . f p 2 7 / c o m 3 i s u s e d a s c o m 3 . f p 2 8 / c o m 2 i s u s e d a s c o m 2 .
a d e 7 5 1 8 r e v . 0 | p a g e 8 2 o f 1 2 8 t a b l e 6 9 . l c d c o n f i g u r a t i o n x s f r ( l c d c o n x , 0 x 9 c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r e s e r v e d 0 r e s e r v e d . 6 e x t r e s 0 e x t e r n a l r e s i s t o r l a d d e r s e l e c t i o n b i t . e x t r e s r e s u l t 0 e x t e r n a l r e s i s t o r l a d d e r i s d i s a b l e d . 1 e x t e r n a l r e s i s t o r l a d d e r i s e n a b l e d . 5 t o 0 r e s e r v e d 0 t h e s e b i t s s h o u l d b e s e t t o 0 f o r p r o p e r o p e r a t i o n . t a b l e 7 0 . l c d c o n f i g u r a t i o n y s f r ( l c d c o n y , 0 x b 1 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 6 i n v _ l v l 0 f r a m e i n v e r s i o n m o d e e n a b l e b i t . i f t h i s b i t i s s e t , f r a m e s a r e i n v e r t e d e v e r y o t h e r f r a m e . i f t h i s b i t i s c l e a r e d , f r a m e s a r e n o t i n v e r t e d . 5 t o 2 r e s e r v e d 0 t h e s e b i t s s h o u l d b e k e p t c l e a r e d f o r p r o p e r o p e r a t i o n . 1 u p d a t e o v e r 0 u p d a t e f i n i s h e d f l a g b i t . t h i s b i t i s u p d a t e d b y t h e l c d d r i v e r . w h e n s e t , t h i s b i t i n d i c a t e s t h a t t h e l c d m e m o r y h a s b e e n u p d a t e d a n d a n e w f r a m e h a s b e g u n . 0 r e f r e s h 0 r e f r e s h l c d d a t a m e m o r y b i t . t h i s b i t s h o u l d b e s e t b y t h e u s e r . w h e n t h i s b i t i s s e t , t h e l c d d r i v e r d o e s n o t u s e t h e d a t a i n t h e l c d d a t a r e g i s t e r s t o u p d a t e t h e d i s p l a y . t h e l c d d a t a r e g i s t e r s c a n b e u p d a t e d b y t h e 8 0 5 2 . w h e n t h i s b i t i s c l e a r e d , t h e l c d d r i v e r u s e s t h e d a t a i n t h e l c d d a t a r e g i s t e r s t o u p d a t e t h e d i s p l a y a t t h e n e x t f r a m e . t a b l e 7 1 . l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 b l k m o d [ 1 : 0 ] 0 0 b l i n k m o d e c l o c k s o u r c e c o n f i g u r a t i o n b i t s . b l k m o d [ 1 : 0 ] r e s u l t 0 0 t h e b l i n k r a t e i s c o n t r o l l e d b y s o f t w a r e . t h e d i s p l a y i s o f f . 0 1 t h e b l i n k r a t e i s c o n t r o l l e d b y s o f t w a r e . t h e d i s p l a y i s o n . 1 0 t h e b l i n k r a t e i s 2 h z . 1 1 t h e b l i n k r a t e i s s e t b y b l k f r e q [ 1 : 0 ] . 5 t o 4 b l k f r e q [ 1 : 0 ] 0 0 b l i n k r a t e c o n f i g u r a t i o n b i t s . t h e s e b i t s c o n t r o l t h e l c d b l i n k r a t e i f b l k m o d [ 1 : 0 ] = 1 1 . b l k f r e q [ 1 : 0 ] r e s u l t ( b l i n k r a t e ) 0 0 1 h z 0 1 1 / 2 h z 1 0 1 / 3 h z 1 1 1 / 4 h z 3 t o 0 f d [ 3 : 0 ] 0 l c d f r a m e r a t e s e l e c t i o n b i t s . s e e t a b l e 7 2 a n d t a b l e 7 3 .
a d e 7 5 1 8 r e v . 0 | p a g e 8 3 o f 1 2 8 t a b l e 7 2 . l c d f r a m e r a t e s e l e c t i o n f o r f l c d c l k = 2 0 4 8 h z ( l c d c o n [ 3 ] = 0 ) 2 m u l t i p l e x i n g 3 m u l t i p l e x i n g 4 m u l t i p l e x i n g f d 3 f d 2 f d 1 f d 0 f l c d ( h z ) f r a m e r a t e ( h z ) f l c d ( h z ) f r a m e r a t e ( h z ) f l c d ( h z ) f r a m e r a t e ( h z ) 0 0 0 1 2 5 6 1 2 8 1 3 4 1 . 3 1 7 0 . 7 1 5 1 2 1 2 8 1 0 0 1 0 1 7 0 . 7 8 5 . 3 3 4 1 . 3 1 1 3 . 8 1 3 4 1 . 3 8 5 . 3 0 0 1 1 1 2 8 6 4 2 5 6 8 5 . 3 2 5 6 6 4 0 1 0 0 1 0 2 . 4 5 1 . 2 2 0 4 . 8 6 8 . 3 2 0 4 . 8 5 1 . 2 0 1 0 1 8 5 . 3 4 2 . 7 1 7 0 . 7 5 6 . 9 1 7 0 . 7 4 2 . 7 0 1 1 0 7 3 . 1 3 6 . 6 1 4 6 . 3 4 8 . 8 1 4 6 . 3 3 6 . 6 0 1 1 1 6 4 3 2 1 2 8 4 2 . 7 1 2 8 3 2 1 0 0 0 5 6 . 9 2 8 . 5 1 1 3 . 8 3 7 . 9 1 1 3 . 8 2 8 . 5 1 0 0 1 5 1 . 2 2 5 . 6 1 0 2 . 4 3 4 . 1 1 0 2 . 4 2 5 . 6 1 0 1 0 4 6 . 5 2 3 . 2 5 9 3 . 1 3 1 9 3 . 1 2 3 . 2 5 1 0 1 1 4 2 . 7 2 1 . 3 5 8 5 . 3 2 8 . 4 8 5 . 3 2 1 . 3 5 1 1 0 0 3 9 . 4 1 9 . 7 7 8 . 8 2 6 . 3 7 8 . 8 1 9 . 7 1 1 0 1 3 6 . 6 1 8 . 3 7 3 . 1 2 4 . 4 7 3 . 1 1 8 . 3 1 1 1 0 3 4 . 1 1 7 . 0 5 6 8 . 3 2 2 . 8 6 8 . 3 1 7 . 0 5 1 1 1 1 3 2 1 6 6 4 2 1 . 3 6 4 1 6 0 0 0 0 1 6 8 3 2 1 0 . 7 3 2 8 1 n o t w i t h i n t h e r a n g e o f t y p i c a l l c d f r a m e r a t e s . t a b l e 7 3 . l c d f r a m e r a t e s e l e c t i o n f o r f l c d c l k = 1 2 8 h z ( l c d c o n [ 3 ] = 1 ) 2 m u l t i p l e x i n g 3 m u l t i p l e x i n g 4 m u l t i p l e x i n g f d 3 f d 2 f d 1 f d 0 f l c d ( h z ) f r a m e r a t e ( h z ) f l c d ( h z ) f r a m e r a t e ( h z ) f l c d ( h z ) f r a m e r a t e ( h z ) 0 0 0 1 3 2 1 6 1 3 2 1 0 . 7 3 2 8 0 0 1 0 2 1 . 3 1 0 . 6 3 2 1 0 . 7 3 2 8 0 0 1 1 1 6 8 3 2 1 0 . 7 3 2 8 0 1 0 0 1 6 8 3 2 1 0 . 7 3 2 8 0 1 0 1 1 6 8 3 2 1 0 . 7 3 2 8 0 1 1 0 1 6 8 3 2 1 0 . 7 3 2 8 0 1 1 1 1 6 8 3 2 1 0 . 7 3 2 8 1 0 0 0 1 6 8 3 2 1 0 . 7 3 2 8 1 0 0 1 1 6 8 3 2 1 0 . 7 3 2 8 1 0 1 0 1 6 8 3 2 1 0 . 7 3 2 8 1 0 1 1 1 6 8 3 2 1 0 . 7 3 2 8 1 1 0 0 1 6 8 3 2 1 0 . 7 3 2 8 1 1 0 1 1 6 8 3 2 1 0 . 7 3 2 8 1 1 1 0 1 6 8 3 2 1 0 . 7 3 2 8 1 1 1 1 1 2 8 6 4 1 2 8 4 2 . 7 1 2 8 3 2 0 0 0 0 6 4 3 2 6 4 2 1 . 3 6 4 1 6 1 n o t w i t h i n t h e r a n g e o f t y p i c a l l c d f r a m e r a t e s . t a b l e 7 4 . l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 f p 2 5 e n 0 f p 2 5 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 6 f p 2 4 e n 0 f p 2 4 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 5 f p 2 3 e n 0 f p 2 3 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 4 f p 2 2 e n 0 f p 2 2 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 3 f p 2 1 e n 0 f p 2 1 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 2 f p 2 0 e n 0 f p 2 0 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 1 t o 0 r e s e r v e d 0 t h e s e b i t s s h o u l d b e l e f t a t 0 f o r p r o p e r o p e r a t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 8 4 o f 1 2 8 t a b l e 7 5 . l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r / w 0 r e a d o r w r i t e l c d b i t . i f t h i s b i t = 1 , t h e d a t a i n l c d d a t i s w r i t t e n t o t h e a d d r e s s i n d i c a t e d b y t h e l c d p t r [ 5 : 0 ] b i t s . 6 r e s e r v e d 0 r e s e r v e d . 5 t o 0 a d d r e s s 0 l c d m e m o r y a d d r e s s ( s e e t a b l e 7 8 ) . t a b l e 7 6 . l c d d a t a s f r ( l c d d a t , 0 x a e ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 l c d d a t a 0 d a t a t o b e w r i t t e n i n t o o r r e a d o u t o f t h e l c d m e m o r y s f r s . t a b l e 7 7 . l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 4 r e s e r v e d 0 r e s e r v e d . 3 f p 1 9 e n 0 f p 1 9 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 2 f p 1 8 e n 0 f p 1 8 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 1 f p 1 7 e n 0 f p 1 7 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . 0 f p 1 6 e n 0 f p 1 6 f u n c t i o n s e l e c t b i t . 0 = g e n e r a l - p u r p o s e i / o , 1 = l c d f u n c t i o n . l c d s e t u p t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) c o n f i g u r e s t h e l c d m o d u l e t o d r i v e t h e t y p e o f l c d i n t h e u s e r e n d s y s t e m . t h e b i a s a n d l m u x [ 1 : 0 ] b i t s i n t h i s s f r s h o u l d b e s e t a c c o r d i n g t o t h e l c d s p e c i f i c a t i o n s . t h e c o m 2 / f p 2 8 a n d c o m 3 / f p 2 7 p i n s d e f a u l t t o l c d s e g m e n t l i n e s . s e l e c t i n g t h e 3 m u l t i p l e x l e v e l i n t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) b y s e t t i n g l m u x [ 1 : 0 ] = 1 0 c h a n g e s t h e f p 2 8 p i n f u n c t i o n a l i t y t o c o m 2 . t h e 4 m u l t i p l e x l e v e l s e l e c t i o n , l m u x [ 1 : 0 ] = 1 1 , c h a n g e s t h e f p 2 8 p i n f u n c t i o n a l i t y t o c o m 2 a n d t h e f p 2 7 p i n f u n c t i o n a l i t y t o c o m 3 . l c d s e g m e n t s f p 0 t o f p 1 5 a n d f p 2 6 a r e e n a b l e d b y d e f a u l t . a d d i t i o n a l p i n s a r e s e l e c t e d f o r l c d f u n c t i o n a l i t y i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) a n d t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) , w h e r e t h e r e a r e i n d i v i d u a l e n a b l e b i t s f o r t h e f p 1 6 t o f p 2 5 s e g m e n t p i n s . t h e l c d p i n s d o n o t h a v e t o b e e n a b l e d s e q u e n t i a l l y . f o r e x a m p l e , i f t h e a l t e r n a t e f u n c t i o n o f f p 2 3 , t h e t i m e r 2 i n p u t , i s r e q u i r e d , a n y o f t h e o t h e r s h a r e d p i n s , f p 1 6 t o f p 2 5 , c a n b e e n a b l e d i n s t e a d . t h e d i s p l a y e l e m e n t c o n t r o l s e c t i o n c o n t a i n s d e t a i l s a b o u t s e t t i n g u p t h e l c d d a t a m e m o r y t o t u r n i n d i v i d u a l l c d s e g m e n t s o n a n d o f f . s e t t i n g t h e l c d r s t b i t i n t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) r e s e t s t h e l c d d a t a m e m o r y t o i t s d e f a u l t ( 0 ) . a p o w e r - o n r e s e t a l s o c l e a r s t h e l c d d a t a m e m o r y . l c d t i m i n g a n d w a v e f o r m s a n l c d s e g m e n t a c t s l i k e a c a p a c i t o r t h a t i s c h a r g e d a n d d i s c h a r g e d a t a c e r t a i n r a t e . t h i s r a t e , t h e r e f r e s h r a t e , d e t e r m i n e s t h e v i s u a l c h a r a c t e r i s t i c s o f t h e l c d . a s l o w r e f r e s h r a t e r e s u l t s i n t h e l c d b l i n k i n g o n a n d o f f b e t w e e n r e f r e s h e s . a f a s t r e f r e s h r a t e p r e s e n t s a s c r e e n t h a t a p p e a r s t o b e c o n t i n u o u s l y l i t . i n a d d i t i o n , a f a s t e r r e f r e s h r a t e c o n s u m e s m o r e p o w e r . t h e f r a m e r a t e , o r r e f r e s h r a t e , f o r t h e l c d m o d u l e i s d e r i v e d f r o m t h e l c d c l o c k , f l c d c l k . t h e l c d c l o c k i s s e l e c t e d a s 2 0 4 8 h z o r 1 2 8 h z b y t h e c l k s e l b i t i n t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) . t h e m i n i m u m r e f r e s h r a t e n e e d e d f o r t h e l c d t o a p p e a r s o l i d ( w i t h o u t b l i n k i n g ) i s i n d e p e n d e n t o f t h e m u l t i p l e x l e v e l . t h e l c d w a v e f o r m f r e q u e n c y , f l c d , i s t h e f r e q u e n c y a t w h i c h t h e l c d s w i t c h e s t h e a c t i v e c o m m o n l i n e . t h u s , t h e l c d w a v e f o r m f r e q u e n c y d e p e n d s h e a v i l y o n t h e m u l t i p l e x l e v e l . t h e f r a m e r a t e a n d l c d w a v e f o r m f r e q u e n c y a r e s e t b y t h e f l c d c l k , t h e m u l t i p l e x l e v e l , a n d t h e f d [ 3 : 0 ] f r a m e r a t e s e l e c t i o n b i t s i n t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) . t h e l c d m o d u l e p r o v i d e s 1 6 d i f f e r e n t f r a m e r a t e s f o r f l c d c l k = 2 0 4 8 h z , r a n g i n g f r o m 8 h z t o 1 2 8 h z f o r a n l c d w i t h 4 m u l t i p l e x i n g . f e w e r o p t i o n s a r e a v a i l a b l e w i t h f l c d c l k = 1 2 8 h z , r a n g i n g f r o m 8 h z t o 3 2 h z f o r a 4 m u l t i p l e x e d l c d . t h e 1 2 8 h z c l o c k i s b e n e f i c i a l f o r b a t t e r y o p e r a t i o n b e c a u s e i t c o n s u m e s l e s s p o w e r t h a n t h e 2 0 4 8 h z c l o c k . t h e f r a m e r a t e i s s e t b y t h e f d [ 3 : 0 ] b i t s i n t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) ; s e e t a b l e 7 2 a n d t a b l e 7 3 . t h e l c d w a v e f o r m i s i n v e r t e d a t t w i c e t h e l c d w a v e f o r m f r e q u e n c y , f l c d . t h i s w a y , e a c h f r a m e h a s a n a v e r a g e d c o f f s e t o f z e r o . a d c o f f s e t d e g r a d e s t h e l i f e t i m e a n d p e r f o r m a n c e o f t h e l c d .
a d e 7 5 1 8 r e v . 0 | p a g e 8 5 o f 1 2 8 b l i n k m o d e b l i n k m o d e i s e n a b l e d b y s e t t i n g t h e b l i n k e n b i t i n t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) . t h i s m o d e i s u s e d t o a l t e r n a t e b e t w e e n t h e l c d o n s t a t e a n d l c d o f f s t a t e s o t h a t t h e l c d s c r e e n a p p e a r s t o b l i n k . t h e r e a r e t w o b l i n k i n g m o d e s : a s o f t w a r e c o n t r o l l e d b l i n k m o d e a n d a n a u t o m a t i c b l i n k m o d e . s o f t w a r e c o n t r o l l e d b l i n k m o d e t h e l c d b l i n k r a t e c a n b e c o n t r o l l e d b y u s e r c o d e w i t h t h e b l k m o d [ 1 : 0 ] b i t s i n t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) b y t o g g l i n g t h e b i t s t o t u r n t h e d i s p l a y o n a n d o f f a t a r a t e d e t e r - m i n e d b y t h e m c u c o d e . a u t o m a t i c b l i n k m o d e t h e r e a r e f i v e b l i n k r a t e s a v a i l a b l e . t h e s e b l i n k r a t e s a r e s e l e c t e d b y t h e b l k m o d [ 1 : 0 ] a n d b l k f r e q [ 1 : 0 ] b i t s i n t h e l c d c l o c k s f r ( l c d c l k , 0 x 9 6 ) ; s e e t a b l e 7 1 . d i s p l a y e l e m e n t c o n t r o l a b a n k o f 1 5 b y t e s o f d a t a m e m o r y l o c a t e d i n t h e l c d m o d u l e c o n t r o l s t h e o n o r o f f s t a t e o f e a c h l c d s e g m e n t . t h e l c d d a t a m e m o r y i s s t o r e d i n a d d r e s s 0 t h r o u g h a d d r e s s 1 4 i n t h e l c d m o d u l e . e a c h b y t e c o n f i g u r e s t h e o n a n d o f f s t a t e s o f t w o s e g m e n t l i n e s . t h e l s b s s t o r e t h e s t a t e o f t h e e v e n n u m b e r e d s e g m e n t l i n e s , a n d t h e m s b s s t o r e t h e s t a t e o f t h e o d d n u m b e r e d s e g m e n t l i n e s . f o r e x a m p l e , l c d m e m o r y a d d r e s s 0 r e f e r s t o s e g m e n t l i n e s o n e a n d z e r o ( s e e t a b l e 7 8 ) . n o t e t h a t t h e l c d d a t a m e m o r y i s m a i n t a i n e d i n p s m 2 o p e r a t i n g m o d e . t h e l c d d a t a m e m o r y i s a c c e s s e d i n d i r e c t l y t h r o u g h t h e l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) a n d l c d d a t a s f r ( l c d d a t , 0 x a e ) . m o v i n g a v a l u e t o t h e l c d p t r s f r s e l e c t s t h e l c d d a t a b y t e t o b e a c c e s s e d a n d i n i t i a t e s a r e a d o r w r i t e o p e r a t i o n ( s e e t a b l e 7 5 ) . w r i t i n g t o l c d d a t a r e g i s t e r s t o u p d a t e t h e l c d d a t a m e m o r y , f i r s t s e t t h e l s b o f t h e l c d c o n f i g u r a t i o n y s f r ( l c d c o n y , 0 x b 1 ) t o f r e e z e t h e d a t a b e i n g d i s p l a y e d o n t h e l c d w h i l e u p d a t i n g i t . t h e n , m o v e t h e d a t a t o t h e l c d d a t a s f r ( l c d d a t , 0 x a e ) p r i o r t o a c c e s s i n g t h e l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) . w h e n t h e m s b o f t h e l c d p t r s f r i s s e t , t h e c o n t e n t o f t h e l c d d a t s f r i s t r a n s - f e r r e d t o t h e i n t e r n a l l c d d a t a m e m o r y d e s i g n a t e d b y t h e a d d r e s s i n t h e l c d p t r s f r . c l e a r t h e l s b o f t h e l c d c o n f i g u r a t i o n y s f r ( l c d c o n y , 0 x b 1 ) w h e n a l l o f t h e d a t a m e m o r y h a s b e e n u p d a t e d t o a l l o w t h e u s e o f t h e n e w l c d s e t u p f o r d i s p l a y . t o u p d a t e t h e s e g m e n t s a t t a c h e d t o t h e f p 1 0 a n d f p 1 1 p i n s , u s e t h e f o l l o w i n g s a m p l e 8 0 5 2 c o d e : o r l l c d c o n y , # 0 1 h ; s t a r t u p d a t i n g t h e d a t a m o v l c d d a t , # f f h m o v l c d p t r , # 8 0 h o r 0 5 h a n l l c d c o n y , # 0 f e h ; u p d a t e f i n i s h e d r e a d i n g l c d d a t a r e g i s t e r s w h e n t h e m s b o f t h e l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) i s c l e a r e d , t h e c o n t e n t o f t h e l c d d a t a m e m o r y a d d r e s s d e s i g n a t e d b y l c d p t r i s t r a n s f e r r e d t o t h e l c d d a t a s f r ( l c d d a t , 0 x a e ) . s a m p l e 8 0 5 2 c o d e t o r e a d t h e c o n t e n t s o f l c d d a t a m e m o r y a d d r e s s 0 x 0 7 , w h i c h h o l d s t h e o n a n d o f f s t a t e o f t h e s e g m e n t s a t t a c h e d t o f p 1 4 a n d f p 1 5 , i s a s f o l l o w s : m o v l c d p t r , # 0 7 h m o v r 1 , l c d d a t t a b l e 7 8 . l c d d a t a m e m o r y a c c e s s e d i n d i r e c t l y t h r o u g h l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) a n d l c d d a t a s f r ( l c d d a t , 0 x a e ) 1 , 2 l c d p o i n t e r s f r ( l c d p t r , 0 x a c ) l c d p o i n t e r s f r ( l c d d a t , 0 x a e ) l c d m e m o r y a d d r e s s c o m 3 c o m 2 c o m 1 c o m 0 c o m 3 c o m 2 c o m 1 c o m 0 0 x 0 e f p 2 8 f p 2 8 f p 2 8 f p 2 8 0 x 0 d f p 2 7 f p 2 7 f p 2 7 f p 2 7 f p 2 6 f p 2 6 f p 2 6 f p 2 6 0 x 0 c f p 2 5 f p 2 5 f p 2 5 f p 2 5 f p 2 4 f p 2 4 f p 2 4 f p 2 4 0 x 0 b f p 2 3 f p 2 3 f p 2 3 f p 2 3 f p 2 2 f p 2 2 f p 2 2 f p 2 2 0 x 0 a f p 2 1 f p 2 1 f p 2 1 f p 2 1 f p 2 0 f p 2 0 f p 2 0 f p 2 0 0 x 0 9 f p 1 9 f p 1 9 f p 1 9 f p 1 9 f p 1 8 f p 1 8 f p 1 8 f p 1 8 0 x 0 8 f p 1 7 f p 1 7 f p 1 7 f p 1 7 f p 1 6 f p 1 6 f p 1 6 f p 1 6 0 x 0 7 f p 1 5 f p 1 5 f p 1 5 f p 1 5 f p 1 4 f p 1 4 f p 1 4 f p 1 4 0 x 0 6 f p 1 3 f p 1 3 f p 1 3 f p 1 3 f p 1 2 f p 1 2 f p 1 2 f p 1 2 0 x 0 5 f p 1 1 f p 1 1 f p 1 1 f p 1 1 f p 1 0 f p 1 0 f p 1 0 f p 1 0 0 x 0 4 f p 9 f p 9 f p 9 f p 9 f p 8 f p 8 f p 8 f p 8 0 x 0 3 f p 7 f p 7 f p 7 f p 7 f p 6 f p 6 f p 6 f p 6 0 x 0 2 f p 5 f p 5 f p 5 f p 5 f p 4 f p 4 f p 4 f p 4 0 x 0 1 f p 3 f p 3 f p 3 f p 3 f p 2 f p 2 f p 2 f p 2 0 x 0 0 f p 1 f p 1 f p 1 f p 1 f p 0 f p 0 f p 0 f p 0 1 c o m x d e s i g n a t e s t h e c o m m o n l i n e s . 2 f p x d e s i g n a t e s t h e s e g m e n t l i n e s .
a d e 7 5 1 8 r e v . 0 | p a g e 8 6 o f 1 2 8 l c d e x t e r n a l c i r c u i t r y t h e v o l t a g e g e n e r a t i o n s e l e c t i o n i s m a d e b y s e t t i n g b i t e x t r e s i n t h e l c d c o n f i g u r a t i o n x s f r ( l c d c o n x , 0 x 9 c ) . t h i s b i t i s c l e a r e d b y d e f a u l t a n d n e e d s t o b e s e t t o e n a b l e a n e x t e r n a l r e s i s t o r l a d d e r . e x t e r n a l r e s i s t o r l a d d e r t o e n a b l e t h e e x t e r n a l r e s i s t o r l a d d e r , s e t t h e e x t r e s b i t i n t h e l c d c o n f i g u r a t i o n x s f r ( l c d c o n x , 0 x 9 c ) . w h e n e x t r e s = 1 , t h e l c d w a v e f o r m v o l t a g e s a r e s u p p l i e d b y t h e e x t e r n a l r e s i s t o r l a d d e r . b e c a u s e t h e l c d v o l t a g e s a r e n o t g e n e r a t e d o n c h i p , t h e l c d b i a s c o m p e n s a t i o n i m p l e m e n t e d t o m a i n t a i n c o n t r a s t o v e r t e m p e r a t u r e a n d s u p p l y i s n o t p o s s i b l e . t h e e x t e r n a l c i r c u i t r y n e e d e d f o r t h e r e s i s t o r l a d d e r o p t i o n i s s h o w n i n f i g u r e 7 7 . t h e r e s i s t o r s r e q u i r e d s h o u l d b e i n t h e r a n g e o f 1 0 k t o 1 0 0 k a n d b a s e d o n t h e c u r r e n t r e q u i r e d b y t h e l c d b e i n g u s e d . l c d v c l c d v b l c d v a l c d v p 1 l c d v p 2 l c d w a v e f o r m c i r c u i t r y 0 7 3 2 7 - 0 7 6 f i g u r e 7 6 . e x t e r n a l c i r c u i t r y f o r e x t e r n a l r e s i s t o r l a d d e r o p t i o n 1 / 2 b i a s c o n f i g u r a t i o n l c d v c l c d v b l c d v a l c d v p 1 l c d v p 2 l c d w a v e f o r m c i r c u i t r y 0 7 3 2 7 - 0 7 7 f i g u r e 7 7 . e x t e r n a l c i r c u i t r y f o r e x t e r n a l r e s i s t o r l a d d e r o p t i o n 1 / 3 b i a s c o n f i g u r a t i o n l c d f u n c t i o n i n p s m 2 t h e l c d p s m 2 a n d l c d e n b i t s i n t h e l c d c o n f i g u r a t i o n s f r ( l c d c o n , 0 x 9 5 ) c o n t r o l l c d f u n c t i o n a l i t y i n p s m 2 o p e r a t i n g m o d e ( s e e t a b l e 7 9 ) . t a b l e 7 9 . b i t s c o n t r o l l i n g l c d f u n c t i o n a l i t y i n p s m 2 m o d e l c d p s m 2 l c d e n r e s u l t 0 0 t h e d i s p l a y i s o f f i n p s m 2 . 0 1 t h e d i s p l a y i s o n i n p s m 2 . 1 x t h e d i s p l a y i s o f f i n p s m 2 . i n a d d i t i o n , n o t e t h a t t h e l c d c o n f i g u r a t i o n a n d d a t a m e m o r y i s r e t a i n e d w h e n t h e d i s p l a y i s t u r n e d o f f . e x a m p l e l c d s e t u p a n e x a m p l e o f h o w t o s e t u p t h e l c d p e r i p h e r a l f o r a s p e c i f i c l c d i s d e s c r i b e d i n t h i s s e c t i o n w i t h t h e f o l l o w i n g p a r a m e t e r s : x t y p e o f l c d : 4 m u l t i p l e x e d w i t h 1 / 3 b i a s , 9 6 s e g m e n t s x r e f r e s h r a t e : 6 4 h z a 9 6 - s e g m e n t l c d w i t h 4 m u l t i p l e x i n g r e q u i r e s 9 6 / 4 = 2 4 s e g m e n t l i n e s . s i x t e e n p i n s , f p 0 t o f p 1 5 , a r e a u t o m a t i c a l l y d e d i c a t e d f o r u s e a s l c d s e g m e n t s . e i g h t m o r e p i n s m u s t b e c h o s e n f o r t h e l c d f u n c t i o n . b e c a u s e t h e l c d h a s 4 m u l t i - p l e x i n g , a l l f o u r c o m m o n l i n e s a r e u s e d . a s a r e s u l t , c o m 2 / f p 2 8 a n d c o m 3 / f p 2 7 c a n n o t b e u s e d a s s e g m e n t l i n e s . b a s e d o n t h e a l t e r n a t e f u n c t i o n s o f t h e p i n s u s e d f o r f p 1 6 t h r o u g h f p 2 5 , f p 1 6 t o f p 2 3 a r e c h o s e n f o r t h e e i g h t r e m a i n i n g s e g m e n t l i n e s . t h e s e p i n s a r e e n a b l e d f o r l c d f u n c t i o n a l i t y i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) a n d l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . t h e l c d i s s e t u p w i t h t h e f o l l o w i n g 8 0 5 2 c o d e : ; s e t u p l c d p i n s t o h a v e l c d f u n c t i o n a l i t y m o v l c d s e g , # f p 2 0 e n + f p 2 1 e n + f p 2 2 e n + f p 2 3 e n m o v l c d s e g x , # f p 1 6 e n + f p 1 7 e n + f p 1 8 e n + f p 1 9 e n ; s e t u p l c d c o n f o r f l c d c l k = 2 0 4 8 h z , 1 / 3 b i a s a n d 4 m u l t i p l e x i n g m o v l c d c o n , # b i a s + l m u x 1 + l m u x 0 ; s e t u p l c d c o n x f o r r e s i s t o r l a d d e r m o v l c d c o n x , # 4 0 h ; s e t u p r e f r e s h r a t e f o r 6 4 h z w i t h f l c d c l k = 2 0 4 8 h z m o v l c d c l k , # f d 3 + f d 2 + f d 1 + f d 0 ; s e t u p l c d d a t a r e g i s t e r s w i t h d a t a t o b e d i s p l a y e d u s i n g ; l c d p t r a n d l c d d a t a r e g i s t e r s ; t u r n a l l s e g m e n t s o n f p 2 7 o n a n d f p 2 6 o f f o r l l c d c o n y , # 0 1 h ; s t a r t d a t a m e m o r y r e f r e s h m o v l c d d a t , # f 0 h m o v l c d p t r , # 8 0 h o r 0 d h a n l l c d c o n y , # 0 f e h ; e n d o f d a t a m e m o r y r e f r e s h o r l l c d c o n , # l c d e n ; e n a b l e l c d t o s e t u p t h e s a m e 3 . 3 v l c d f o r u s e w i t h a n e x t e r n a l r e s i s t o r l a d d e r , ; s e t u p l c d c o n x f o r e x t e r n a l r e s i s t o r l a d d e r m o v l c d c o n x , # e x t r e s
a d e 7 5 1 8 r e v . 0 | p a g e 8 7 o f 1 2 8 f l a s h m e m o r y o v e r v i e w f l a s h m e m o r y i s a t y p e o f n o n v o l a t i l e m e m o r y t h a t i s i n - c i r c u i t p r o g r a m m a b l e . t h e d e f a u l t s t a t e o f a b y t e o f f l a s h m e m o r y i s 0 x f f ( e r a s e d ) . w h e n a b y t e o f f l a s h m e m o r y i s p r o g r a m m e d , t h e r e q u i r e d b i t s c h a n g e f r o m 1 t o 0 . t h e f l a s h m e m o r y m u s t b e e r a s e d t o t u r n t h e 0 s b a c k t o 1 s . h o w e v e r , a b y t e o f f l a s h m e m o r y c a n n o t b e e r a s e d i n d i v i d u a l l y . t h e e n t i r e s e g m e n t , o r p a g e , o f f l a s h m e m o r y t h a t c o n t a i n s t h e b y t e m u s t b e e r a s e d . t h e a d e 7 5 1 8 p r o v i d e s 1 6 k b o f f l a s h p r o g r a m / i n f o r m a t i o n m e m o r y . t h i s m e m o r y i s s e g m e n t e d i n t o 3 2 p a g e s o f 5 1 2 b y t e s e a c h . t h e r e f o r e , t o r e p r o g r a m o n e b y t e o f f l a s h m e m o r y , t h e o t h e r 5 1 1 b y t e s i n t h a t p a g e m u s t b e e r a s e d . t h e f l a s h m e m o r y c a n b e e r a s e d b y p a g e o r a l l a t o n c e i n a m a s s e r a s e . t h e r e i s a c o m m a n d t o v e r i f y t h a t a f l a s h w r i t e o p e r a t i o n h a s c o m p l e t e d s u c c e s s f u l l y . t h e a d e 7 5 1 8 f l a s h m e m o r y c o n t r o l l e r a l s o o f f e r s c o n f i g u r a b l e f l a s h m e m o r y p r o t e c t i o n . t h e 1 6 k b o f f l a s h m e m o r y a r e p r o v i d e d o n - c h i p t o f a c i l i t a t e c o d e e x e c u t i o n w i t h o u t a n y e x t e r n a l d i s c r e t e r o m d e v i c e r e q u i r e m e n t s . t h e p r o g r a m m e m o r y c a n b e p r o g r a m m e d i n - c i r c u i t , u s i n g t h e s e r i a l d o w n l o a d o r e m u l a t i o n o p t i o n s p r o v i d e d o r u s i n g c o n v e n t i o n a l t h i r d p a r t y m e m o r y p r o g r a m m e r s . f l a s h / e e m e m o r y r e l i a b i l i t y t h e f l a s h m e m o r y a r r a y s o n t h e a d e 7 5 1 8 a r e f u l l y q u a l i f i e d f o r t w o k e y f l a s h / e e m e m o r y c h a r a c t e r i s t i c s : f l a s h / e e m e m o r y c y c l i n g e n d u r a n c e a n d f l a s h / e e m e m o r y d a t a r e t e n t i o n . e n d u r a n c e q u a n t i f i e s t h e a b i l i t y o f t h e f l a s h / e e m e m o r y t o b e c y c l e d t h r o u g h m a n y p r o g r a m , r e a d , a n d e r a s e c y c l e s . i n r e a l t e r m s , a s i n g l e e n d u r a n c e c y c l e i s c o m p o s e d o f t h e f o l l o w i n g f o u r i n d e p e n d e n t , s e q u e n t i a l e v e n t s : 1 . i n i t i a l p a g e e r a s e s e q u e n c e . 2 . r e a d / v e r i f y s e q u e n c e . 3 . b y t e p r o g r a m s e q u e n c e . 4 . s e c o n d r e a d / v e r i f y s e q u e n c e . i n r e l i a b i l i t y q u a l i f i c a t i o n , e v e r y b y t e i n b o t h t h e p r o g r a m a n d d a t a f l a s h / e e m e m o r y i s c y c l e d f r o m 0 x 0 0 t o 0 x f f u n t i l a f i r s t f a i l i s r e c o r d e d , s i g n i f y i n g t h e e n d u r a n c e l i m i t o f t h e o n - c h i p f l a s h / e e m e m o r y . a s i n d i c a t e d i n t h e s p e c i f i c a t i o n s s e c t i o n , t h e a d e 7 5 1 8 f l a s h m e m o r y e n d u r a n c e q u a l i f i c a t i o n h a s b e e n c a r r i e d o u t i n a c c o r d a n c e w i t h j e d e c s t a n d a r d 2 2 m e t h o d a 1 1 7 o v e r t h e i n d u s t r i a l t e m p e r a t u r e r a n g e o f ? 4 0 c , + 2 5 c , a n d + 8 5 c . t h e r e s u l t s a l l o w t h e s p e c i f i c a t i o n o f a m i n i m u m e n d u r a n c e f i g u r e o v e r s u p p l y a n d t e m p e r a t u r e o f 1 0 0 , 0 0 0 c y c l e s , w i t h a m i n i m u m e n d u r a n c e f i g u r e o f 2 0 , 0 0 0 c y c l e s o f o p e r a t i o n a t 2 5 c . r e t e n t i o n i s t h e a b i l i t y o f t h e f l a s h m e m o r y t o r e t a i n i t s p r o - g r a m m e d d a t a o v e r t i m e . a g a i n , t h e p a r t s h a v e b e e n q u a l i f i e d i n a c c o r d a n c e w i t h t h e f o r m a l j e d e c s t a n d a r d 2 2 m e t h o d a 1 1 7 a t a s p e c i f i c j u n c t i o n t e m p e r a t u r e ( t j = 5 5 c ) . a s p a r t o f t h i s q u a l i f i c a t i o n p r o c e d u r e , t h e f l a s h m e m o r y i s c y c l e d t o i t s s p e c i f i e d e n d u r a n c e l i m i t b e f o r e d a t a r e t e n t i o n i s c h a r a c t e r i z e d . t h i s m e a n s t h a t t h e f l a s h m e m o r y i s g u a r a n t e e d t o r e t a i n i t s d a t a f o r i t s f u l l s p e c i f i e d r e t e n t i o n l i f e t i m e e v e r y t i m e t h e f l a s h m e m o r y i s r e p r o g r a m m e d . i t s h o u l d a l s o b e n o t e d t h a t r e t e n t i o n l i f e t i m e , b a s e d o n a n a c t i v a t i o n e n e r g y o f 0 . 6 e v , d e r a t e s w i t h t j , a s s h o w n i n f i g u r e 7 8 . 4 0 6 0 7 0 9 0 t j j u n c t i o n t e m p e r a t u r e ( c ) r e t e n t i o n ( y e a r s ) 2 5 0 2 0 0 1 5 0 1 0 0 5 0 0 5 0 8 0 1 1 0 3 0 0 1 0 0 a n a l o g d e v i c e s s p e c i f i c a t i o n 1 0 0 y e a r s m i n . a t t j = 5 5 c 0 7 3 2 7 - 0 7 8 f i g u r e 7 8 . f l a s h / e e m e m o r y d a t a r e t e n t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 8 8 o f 1 2 8 f l a s h m e m o r y o r g a n i z a t i o n t h e 1 6 k b o f f l a s h m e m o r y p r o v i d e d b y t h e a d e 7 5 1 8 a r e s e g - m e n t e d i n t o 3 2 p a g e s o f 5 1 2 b y t e s e a c h . i t i s u p t o t h e u s e r t o d e c i d e w h i c h f l a s h m e m o r y t o a l l o c a t e f o r d a t a m e m o r y . i t i s r e c o m m e n d e d t h a t e a c h p a g e b e d e d i c a t e d s o l e l y t o p r o g r a m m e m o r y o r t o d a t a m e m o r y . d o i n g s o p r e v e n t s t h e p r o g r a m c o u n t e r f r o m b e i n g l o a d e d w i t h d a t a m e m o r y i n s t e a d o f a n o p e r a t i o n s c o d e f r o m t h e p r o g r a m m e m o r y . i t a l s o p r e v e n t s p r o g r a m m e m o r y u s e d t o u p d a t e a b y t e o f d a t a m e m o r y f r o m b e i n g e r a s e d . 0 x 3 e 0 0 0 x 3 d f f 0 x 3 c 0 0 0 x 3 b f f 0 x 3 a 0 0 0 x 3 9 f f 0 x 3 8 0 0 0 x 3 7 f f 0 x 3 6 0 0 0 x 3 5 f f 0 x 3 4 0 0 0 x 3 3 f f 0 x 3 2 0 0 0 x 3 1 f f 0 x 3 0 0 0 0 x 2 f f f 0 x 2 e 0 0 0 x 2 d f f 0 x 2 c 0 0 0 x 2 b f f 0 x 2 a 0 0 0 x 2 9 f f 0 x 2 8 0 0 0 x 2 7 f f 0 x 2 6 0 0 0 x 2 5 f f 0 x 2 4 0 0 0 x 2 3 f f 0 x 2 2 0 0 0 x 2 1 f f 0 x 2 0 0 0 0 x 3 f f f c o n t a i n s p r o t e c t i o n s e t t i n g s . r e a d p r o t e c t b i t 7 r e a d p r o t e c t b i t 6 r e a d p r o t e c t b i t 5 r e a d p r o t e c t b i t 4 p a g e 3 0 p a g e 2 9 p a g e 2 8 p a g e 2 7 p a g e 2 6 p a g e 2 5 p a g e 2 4 p a g e 2 3 p a g e 2 2 p a g e 2 1 p a g e 2 0 p a g e 1 9 p a g e 1 8 p a g e 1 7 p a g e 1 6 p a g e 3 1 0 x 1 e 0 0 0 x 1 d f f 0 x 1 c 0 0 0 x 1 b f f 0 x 1 a 0 0 0 x 1 9 f f 0 x 1 8 0 0 0 x 1 7 f f 0 x 1 6 0 0 0 x 1 5 f f 0 x 1 4 0 0 0 x 1 3 f f 0 x 1 2 0 0 0 x 1 1 f f 0 x 1 0 0 0 0 x 0 f f f 0 x 0 e 0 0 0 x 0 d f f 0 x 0 c 0 0 0 x 0 b f f 0 x 0 a 0 0 0 x 0 9 f f 0 x 0 8 0 0 0 x 0 7 f f 0 x 0 6 0 0 0 x 0 5 f f 0 x 0 4 0 0 0 x 0 3 f f 0 x 0 2 0 0 0 x 0 1 f f 0 x 0 0 0 0 0 x 1 f f f r e a d p r o t e c t b i t 3 r e a d p r o t e c t b i t 2 r e a d p r o t e c t b i t 1 r e a d p r o t e c t b i t 0 p a g e 1 4 p a g e 1 3 p a g e 1 2 p a g e 1 1 p a g e 1 0 p a g e 9 p a g e 8 p a g e 7 p a g e 6 p a g e 5 p a g e 4 p a g e 3 p a g e 2 p a g e 1 p a g e 0 p a g e 1 5 0 7 3 2 7 - 0 7 9 f i g u r e 7 9 . f l a s h m e m o r y o r g a n i z a t i o n t h e f l a s h m e m o r y c a n b e p r o t e c t e d f r o m r e a d o r w r i t e / e r a s e ( w / e ) a c c e s s . t h e p r o t e c t i o n i s i m p l e m e n t e d i n p a r t o f t h e l a s t p a g e o f t h e f l a s h m e m o r y , p a g e 3 1 . f o u r o f t h e b y t e s f r o m t h i s p a g e a r e u s e d t o s e t u p w r i t e / e r a s e p r o t e c t i o n f o r e a c h p a g e . a n o t h e r b y t e i s u s e d f o r c o n f i g u r i n g r e a d p r o t e c t i o n o f t h e f l a s h m e m o r y . t h e r e a d p r o t e c t i o n i s s e l e c t e d f o r g r o u p s o f f o u r p a g e s . f i n a l l y , o n e b y t e i s u s e d t o s t o r e t h e k e y r e q u i r e d f o r m o d i f y i n g t h e p r o t e c t i o n s c h e m e . t h e l a s t p a g e o f f l a s h m e m o r y m u s t b e w r i t e / e r a s e p r o t e c t e d f o r a n y f l a s h p r o t e c t i o n t o b e a c t i v e . t h e i m p l i c a t i o n o f w r i t e / e r a s e p r o t e c t i n g t h e l a s t p a g e i s t h a t t h e c o n t e n t o f t h e 5 0 6 b y t e s i n t h i s p a g e t h a t a r e a v a i l a b l e t o t h e u s e r m u s t n o t c h a n g e . t h u s , i f c o d e p r o t e c t i o n i s e n a b l e d , i t i s r e c o m m e n d e d t o u s e t h i s l a s t p a g e f o r p r o g r a m m e m o r y o n l y ( i f t h e f i r m w a r e d o e s n o t n e e d t o b e u p d a t e d i n t h e f i e l d ) . i f t h e f i r m w a r e m u s t b e p r o t e c t e d a n d c a n b e u p d a t e d a t a f u t u r e d a t e , t h e l a s t p a g e s h o u l d b e u s e d o n l y f o r c o n s t a n t s u t i l i z e d b y t h e p r o g r a m c o d e . t h e r e f o r e , p a g e 0 t h r o u g h p a g e 3 0 a r e f o r g e n e r a l p r o g r a m a n d d a t a m e m o r y u s e . i t i s r e c o m m e n d e d t h a t p a g e 3 1 b e u s e d f o r c o n s t a n t s o r c o d e t h a t d o n o t n e e d t o b e u p d a t e d . n o t e t h a t t h e l a s t s i x b y t e s o f p a g e 3 1 a r e r e s e r v e d f o r p r o t e c t i n g t h e f l a s h m e m o r y . u s i n g t h e f l a s h m e m o r y t h e 1 6 k b o f f l a s h m e m o r y a r e c o n f i g u r e d a s 3 2 p a g e s , e a c h o f 5 1 2 b y t e s . a s w i t h t h e o t h e r a d e 7 5 1 8 p e r i p h e r a l s , t h e i n t e r f a c e t o t h i s m e m o r y s p a c e i s v i a a g r o u p o f r e g i s t e r s m a p p e d i n t h e s f r s p a c e ( s e e t a b l e 8 0 ) . a d a t a r e g i s t e r , e d a t a , h o l d s t h e b y t e o f d a t a t o b e a c c e s s e d . t h e b y t e o f f l a s h m e m o r y i s a d d r e s s e d v i a t h e e a d r h a n d e a d r l r e g i s t e r s . f i n a l l y , e c o n i s a n 8 - b i t c o n t r o l r e g i s t e r t h a t c a n b e w r i t t e n t o w i t h o n e o f s e v e n f l a s h m e m o r y a c c e s s c o m m a n d s t o t r i g g e r v a r i o u s r e a d , w r i t e , e r a s e , a n d v e r i f y f u n c t i o n s . t a b l e 8 0 . t h e f l a s h s f r s s f r a d d r e s s d e f a u l t b i t a d d r e s s a b l e d e s c r i p t i o n e c o n 0 x b 9 0 x 0 0 n o f l a s h c o n t r o l f l s h k y 0 x b a 0 x f f n o f l a s h k e y p r o t k y 0 x b b 0 x f f n o f l a s h p r o t e c t i o n k e y e d a t a 0 x b c 0 x 0 0 n o f l a s h d a t a p r o t b 0 0 x b d 0 x f f n o f l a s h w / e p r o t e c t i o n 0 p r o t b 1 0 x b e 0 x f f n o f l a s h w / e p r o t e c t i o n 1 p r o t r 0 x b f 0 x f f n o f l a s h r e a d p r o t e c t i o n e a d r l 0 x c 6 0 x 0 0 n o f l a s h l o w b y t e a d d r e s s e a d r h 0 x c 7 0 x 0 0 n o f l a s h h i g h b y t e a d d r e s s f i g u r e 8 0 d e m o n s t r a t e s t h e s t e p s r e q u i r e d f o r a c c e s s t o t h e f l a s h m e m o r y . e a d r h f l s h k y e a d r l a d d r e s s a d d r e s s d e c o d e r f l s h k y = 0 3 b ? p r o t e c t i o n d e c o d e r e c o n c o m m a n d a c c e s s a l l o w e d ? f l a s h p r o t e c t i o n k e y t r u e : a c c e s s a l l o w e d e c o n = 0 f a l s e : a c c e s s d e n i e d e c o n = 1 0 7 3 2 7 - 0 8 0 f i g u r e 8 0 . f l a s h m e m o r y r e a d / w r i t e / e r a s e p r o t e c t i o n b l o c k d i a g r a m
a d e 7 5 1 8 r e v . 0 | p a g e 8 9 o f 1 2 8 e c o n ? f l a s h / e e m e m o r y c o n t r o l s f r p r o g r a m m i n g f l a s h m e m o r y i s d o n e t h r o u g h t h e f l a s h c o n t r o l s f r ( e c o n , 0 x b 9 ) . t h i s s f r a l l o w s t h e u s e r t o r e a d , w r i t e , e r a s e , o r v e r i f y t h e 1 6 k b o f f l a s h m e m o r y . a s a m e t h o d o f s e c u r i t y , a k e y m u s t b e w r i t t e n t o t h e f l s h k y r e g i s t e r t o i n i t i a t e a n y u s e r a c c e s s t o t h e f l a s h m e m o r y . u p o n c o m p l e t i o n o f t h e f l a s h m e m o r y o p e r a t i o n , t h e f l s h k y r e g i s t e r i s r e s e t s o t h a t i t m u s t b e w r i t t e n t o p r i o r t o a n o t h e r f l a s h m e m o r y o p e r a t i o n . r e q u i r i n g t h e k e y t o b e s e t b e f o r e a n a c c e s s t o t h e f l a s h m e m o r y d e c r e a s e s t h e l i k e l i h o o d o f u s e r c o d e o r d a t a b e i n g o v e r w r i t t e n b y a p r o g r a m i n a p p r o p r i a t e l y m o d i f i e d d u r i n g i t s e x e c u t i o n . t h e p r o g r a m c o u n t e r ( p c ) i s h e l d o n t h e i n s t r u c t i o n w h e r e t h e e c o n r e g i s t e r i s w r i t t e n t o u n t i l t h e f l a s h m e m o r y c o n t r o l l e r i s d o n e p e r f o r m i n g t h e r e q u e s t e d o p e r a t i o n . t h e n , t h e p c i n c r e - m e n t s t o c o n t i n u e w i t h t h e n e x t i n s t r u c t i o n . a n y i n t e r r u p t r e q u e s t s t h a t o c c u r w h i l e t h e f l a s h c o n t r o l l e r i s p e r f o r m i n g a n o p e r a t i o n a r e n o t h a n d l e d u n t i l t h e f l a s h o p e r a t i o n i s c o m p l e t e . a l l p e r i p h e r a l s , s u c h a s t i m e r s a n d c o u n t e r s , c o n t i n u e t o o p e r a t e a s c o n f i g u r e d t h r o u g h o u t t h e f l a s h m e m o r y a c c e s s . t a b l e 8 1 . f l a s h c o n t r o l s f r ( e c o n , 0 x b 9 ) b i t m n e m o n i c v a l u e d e s c r i p t i o n 7 t o 0 e c o n 1 w r i t e b y t e . t h e v a l u e i n e d a t a i s w r i t t e n t o t h e f l a s h m e m o r y a t t h e p a g e a d d r e s s g i v e n b y e a d r h a n d e a d r l . n o t e t h a t t h e b y t e b e i n g a d d r e s s e d m u s t b e p r e - e r a s e d . 2 e r a s e p a g e . a 5 1 2 - b y t e p a g e o f f l a s h m e m o r y a d d r e s s i s e r a s e d . t h e p a g e i s s e l e c t e d b y t h e a d d r e s s i n e a d r h / e a d r l . a n y a d d r e s s i n t h e p a g e c a n b e w r i t t e n t o e a d r h / e a d r l t o s e l e c t i t f o r e r a s u r e . 3 e r a s e a l l . a l l 1 6 k b o f t h e f l a s h m e m o r y a r e e r a s e d . n o t e t h a t t h i s c o m m a n d i s u s e d d u r i n g s e r i a l a n d p a r a l l e l d o w n l o a d m o d e s b u t s h o u l d n o t b e e x e c u t e d b y u s e r c o d e . 4 r e a d b y t e . t h e b y t e i n t h e f l a s h m e m o r y a d d r e s s e d b y e a d r h / e a d r l i s r e a d i n t o e d a t a . 5 e r a s e p a g e a n d w r i t e b y t e . t h e p a g e t h a t h o l d s t h e b y t e a d d r e s s e d b y e a d r h / e a d r l i s e r a s e d . d a t a i n e d a t a i s t h e n w r i t t e n t o t h e b y t e o f f l a s h m e m o r y a d d r e s s e d b y e a d r h / e a d r l . 8 p r o t e c t c o d e ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . t a b l e 8 2 . f l a s h k e y s f r ( f l s h k y , 0 x b a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 f l s h k y 0 x f f t h e c o n t e n t o f t h i s s f r i s c o m p a r e d t o t h e f l a s h k e y , 0 x 3 b . i f t h e t w o v a l u e s m a t c h , t h e n e x t e c o n o p e r a t i o n i s a l l o w e d ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . t a b l e 8 3 . f l a s h p r o t e c t i o n k e y s f r ( p r o t k y , 0 x b b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 p r o t k y 0 x f f t h e c o n t e n t o f t h i s s f r i s c o m p a r e d t o t h e f l a s h m e m o r y l o c a t i o n a t a d d r e s s 0 x 3 f f a . i f t h e t w o v a l u e s m a t c h , t h e u p d a t e o f t h e w r i t e / e r a s e a n d r e a d p r o t e c t i o n s e t u p i s a l l o w e d ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . i f t h e p r o t e c t i o n k e y i n t h e f l a s h i s 0 x f f , t h e p r o t k y s f r v a l u e i s n o t u s e d f o r c o m p a r i s o n . t h i s s f r i s a l s o u s e d t o w r i t e t h e p r o t e c t i o n k e y i n t h e f l a s h . t h i s i s d o n e b y w r i t i n g t h e d e s i r e d v a l u e i n p r o t k y a n d b y w r i t i n g 0 x 0 8 i n t h e e c o n s f r . t h i s o p e r a t i o n c a n o n l y b e d o n e o n c e . t a b l e 8 4 . f l a s h d a t a s f r ( e d a t a , 0 x b c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 e d a t a 0 f l a s h p o i n t e r d a t a . t a b l e 8 5 . f l a s h w r i t e / e r a s e p r o t e c t i o n 0 s f r ( p r o t b 0 , 0 x b d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 p r o t b 0 0 x f f t h i s s f r i s u s e d t o w r i t e t h e w r i t e / e r a s e p r o t e c t i o n b i t s f o r p a g e 0 t o p a g e 7 o f t h e f l a s h m e m o r y ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . c l e a r i n g t h e b i t s e n a b l e s t h e p r o t e c t i o n . p r o t b 0 . 7 p r o t b 0 . 6 p r o t b 0 . 5 p r o t b 0 . 4 p r o t b 0 . 3 p r o t b 0 . 2 p r o t b 0 . 1 p r o t b 0 . 0 p a g e 7 p a g e 6 p a g e 5 p a g e 4 p a g e 3 p a g e 2 p a g e 1 p a g e 0 t a b l e 8 6 . f l a s h w r i t e / e r a s e p r o t e c t i o n 1 s f r ( p r o t b 1 , 0 x b e ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 p r o t b 1 0 x f f t h i s s f r i s u s e d t o w r i t e t h e w r i t e / e r a s e p r o t e c t i o n b i t s f o r p a g e 8 t o p a g e 1 5 o f t h e f l a s h m e m o r y ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . c l e a r i n g t h e b i t s e n a b l e s t h e p r o t e c t i o n . p r o t b 1 . 7 p r o t b 1 . 6 p r o t b 1 . 5 p r o t b 1 . 4 p r o t b 1 . 3 p r o t b 1 . 2 p r o t b 1 . 1 p r o t b 1 . 0 p a g e 1 5 p a g e 1 4 p a g e 1 3 p a g e 1 2 p a g e 1 1 p a g e 1 0 p a g e 9 p a g e 8
a d e 7 5 1 8 r e v . 0 | p a g e 9 0 o f 1 2 8 t a b l e 8 7 . f l a s h r e a d p r o t e c t i o n s f r ( p r o t r , 0 x b f ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 p r o t r 0 x f f t h i s s f r i s u s e d t o w r i t e t h e r e a d p r o t e c t i o n b i t s f o r p a g e 0 t o p a g e 3 1 o f t h e f l a s h m e m o r y ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . c l e a r i n g t h e b i t s e n a b l e s t h e p r o t e c t i o n . p r o t r . 7 p r o t r . 6 p r o t r . 5 p r o t r . 4 p r o t r . 3 p r o t r . 2 p r o t r . 1 p r o t r . 0 p a g e 2 8 t o p a g e 3 1 p a g e 2 4 t o p a g e 2 7 p a g e 2 0 t o p a g e 2 3 p a g e 1 6 t o p a g e 1 9 p a g e 1 2 t o p a g e 1 5 p a g e 8 t o p a g e 1 1 p a g e 4 t o p a g e 7 p a g e 0 t o p a g e 3 t a b l e 8 8 . f l a s h l o w b y t e a d d r e s s s f r ( e a d r l , 0 x c 6 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 e a d r l 0 f l a s h p o i n t e r l o w b y t e a d d r e s s . t h i s s f r i s a l s o u s e d t o w r i t e t h e w r i t e / e r a s e p r o t e c t i o n b i t s f o r p a g e 1 6 t o p a g e 2 3 o f t h e f l a s h m e m o r y ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . c l e a r i n g t h e b i t s e n a b l e s t h e p r o t e c t i o n . e a d r l . 7 e a d r l . 6 e a d r l . 5 e a d r l . 4 e a d r l . 3 e a d r l . 2 e a d r l . 1 e a d r l . 0 p a g e 2 3 p a g e 2 2 p a g e 2 1 p a g e 2 0 p a g e 1 9 p a g e 1 8 p a g e 1 7 p a g e 1 6 t a b l e 8 9 . f l a s h h i g h b y t e a d d r e s s s f r ( e a d r h , 0 x c 7 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 e a d r h 0 f l a s h p o i n t e r h i g h b y t e a d d r e s s . t h i s s f r i s a l s o u s e d t o w r i t e t h e w r i t e / e r a s e p r o t e c t i o n b i t s f o r p a g e 2 4 t o p a g e 3 1 o f t h e f l a s h m e m o r y ( s e e t h e p r o t e c t i n g t h e f l a s h m e m o r y s e c t i o n ) . c l e a r i n g t h e b i t s e n a b l e s t h e p r o t e c t i o n . e a d r h . 7 e a d r h . 6 e a d r h . 5 e a d r h . 4 e a d r h . 3 e a d r h . 2 e a d r h . 1 e a d r h . 0 p a g e 3 1 p a g e 3 0 p a g e 2 9 p a g e 2 8 p a g e 2 7 p a g e 2 6 p a g e 2 5 p a g e 2 4 f l a s h f u n c t i o n s s a m p l e 8 0 5 2 c o d e i s p r o v i d e d i n t h i s s e c t i o n t o d e m o n s t r a t e h o w t o u s e t h e f l a s h f u n c t i o n s . f o r t h e s e e x a m p l e s , t h e b y t e o f f l a s h m e m o r y 0 x 3 c 0 0 i s a c c e s s e d . w r i t e b y t e w r i t e 0 x f 3 i n t o f l a s h m e m o r y b y t e 0 x 3 c 0 0 . m o v e d a t a , # f 3 h ; d a t a t o b e w r i t t e n m o v e a d r h , # 3 c h ; s e t u p b y t e a d d r e s s m o v e a d r l , # 0 0 h m o v f l s h k y , # 3 b h ; w r i t e f l a s h s e c u r i t y k e y . m o v e c o n , # 0 1 h ; w r i t e b y t e e r a s e p a g e e r a s e t h e p a g e c o n t a i n i n g f l a s h m e m o r y b y t e 0 x 3 c 0 0 . m o v e a d r h , # 3 c h ; s e l e c t p a g e t h r o u g h b y t e a d d r e s s m o v e a d r l , # 0 0 h m o v f l s h k y , # 3 b h ; w r i t e f l a s h s e c u r i t y k e y m o v e c o n , # 0 2 h ; e r a s e p a g e e r a s e a l l e r a s e a l l o f t h e 1 6 k b f l a s h m e m o r y . m o v f l s h k y , # 3 b h ; w r i t e f l a s h s e c u r i t y k e y m o v e c o n , # 0 3 h ; e r a s e a l l r e a d b y t e r e a d f l a s h m e m o r y b y t e 0 x 3 c 0 0 . m o v e a d r h , # 3 c h ; s e t u p b y t e a d d r e s s m o v e a d r l , # 0 0 h m o v f l s h k y , # 3 b h ; w r i t e f l a s h s e c u r i t y k e y m o v e c o n , # 0 4 h ; r e a d b y t e ; d a t a i s r e a d y i n e d a t a r e g i s t e r e r a s e p a g e a n d w r i t e b y t e e r a s e t h e p a g e c o n t a i n i n g f l a s h m e m o r y b y t e 0 x 3 c 0 0 a n d t h e n w r i t e 0 x f 3 t o t h a t a d d r e s s . n o t e t h a t t h e o t h e r 5 1 1 b y t e s i n t h i s p a g e a r e e r a s e d . m o v e d a t a , # f 3 h ; d a t a t o b e w r i t t e n m o v e a d r h , # 3 c h ; s e t u p b y t e a d d r e s s m o v e a d r l , # 0 0 h m o v f l s h k y , # 3 b h ; w r i t e f l a s h s e c u r i t y k e y m o v e c o n , # 0 5 h ; e r a s e p a g e a n d t h e n w r i t e b y t e
a d e 7 5 1 8 r e v . 0 | p a g e 9 1 o f 1 2 8 p r o t e c t i n g t h e f l a s h m e m o r y t w o f o r m s o f p r o t e c t i o n a r e o f f e r e d f o r t h i s f l a s h m e m o r y : r e a d p r o t e c t i o n a n d w r i t e / e r a s e p r o t e c t i o n . t h e r e a d p r o t e c t i o n e n s u r e s t h a t a n y p a g e s t h a t a r e r e a d p r o t e c t e d a r e n o t a b l e t o b e r e a d b y t h e e n d u s e r . t h e w r i t e p r o t e c t i o n e n s u r e s t h a t t h e f l a s h m e m o r y c a n n o t b e e r a s e d o r w r i t t e n o v e r . t h i s p r o t e c t s t h e e n d s y s t e m f r o m t a m p e r i n g a n d c a n p r e v e n t t h e c o d e f r o m b e i n g o v e r w r i t t e n i n t h e e v e n t o f a n u n e x p e c t e d d i s r u p t i o n o f t h e n o r m a l e x e c u t i o n o f t h e p r o g r a m . w r i t e / e r a s e p r o t e c t i o n i s i n d i v i d u a l l y s e l e c t a b l e f o r a l l 3 2 p a g e s . r e a d p r o t e c t i o n i s s e l e c t e d i n g r o u p s o f f o u r p a g e s ( s e e f i g u r e 7 9 f o r t h e g r o u p i n g s ) . t h e p r o t e c t i o n b i t s a r e s t o r e d i n t h e l a s t f l a s h m e m o r y l o c a t i o n s , a d d r e s s 0 x 3 f f a t h r o u g h a d d r e s s 0 x 3 f f f ( s e e f i g u r e 8 1 ) ; f o u r b y t e s a r e r e s e r v e d f o r w r i t e / e r a s e p r o t e c t i o n , o n e b y t e i s f o r r e a d p r o t e c t i o n , a n d a n o t h e r b y t e s e t s t h e p r o t e c t i o n s e c u r i t y k e y . t h e u s e r m u s t e n a b l e r e a d a n d w r i t e / e r a s e p r o t e c t i o n f o r t h e l a s t p a g e f o r t h e e n t i r e p r o t e c t i o n s c h e m e t o w o r k . n o t e t h a t t h e r e a d p r o t e c t i o n d o e s n o t p r e v e n t m o v c c o m m a n d s f r o m b e i n g e x e c u t e d w i t h i n t h e c o d e . t h e r e i s a n a d d i t i o n a l l a y e r o f p r o t e c t i o n o f f e r e d b y a p r o t e c t i o n s e c u r i t y k e y . t h e u s e r c a n s e t u p t h i s s e c u r i t y k e y s o t h a t t h e p r o t e c t i o n s c h e m e c a n n o t b e c h a n g e d w i t h o u t t h i s k e y . o n c e t h e p r o t e c t i o n k e y h a s b e e n c o n f i g u r e d , i t c a n n o t b e m o d i f i e d . e n a b l i n g f l a s h p r o t e c t i o n b y c o d e t h e p r o t e c t i o n b y t e s i n t h e f l a s h m e m o r y c a n b e p r o g r a m m e d u s i n g t h e f l a s h c o n t r o l l e r c o m m a n d a n d p r o g r a m m i n g e c o n t o 0 x 0 8 . i n t h i s c a s e , t h e e a d r h , e a d r l , p r o t b 1 , a n d p r o t b 0 b y t e s a r e u s e d t o s t o r e t h e d a t a t o b e w r i t t e n t o t h e 3 2 b i t s o f w r i t e p r o t e c t i o n . n o t e t h a t t h e e a d r h a n d e a d r l r e g i s t e r s a r e n o t u s e d a s d a t a p o i n t e r s h e r e b u t t o s t o r e w r i t e p r o t e c t i o n d a t a . p r o t r p r o t k y p r o t b 0 p r o t b 1 e a d r l e a d r h r p 3 1 : 2 8 r p 2 7 : 2 4 r p 2 3 : 2 0 r p 1 9 : 1 6 r p 1 5 : 1 2 r p 1 1 : 8 r p 7 : 4 r p 3 : 0 w p 7 w p 6 w p 5 w p 4 w p 3 w p 2 w p 1 w p 0 w p 1 5 w p 1 4 w p 1 3 w p 1 2 w p 1 1 w p 1 0 w p 9 w p 8 w p 2 3 w p 2 2 w p 2 1 w p 2 0 w p 1 9 w p 1 8 w p 1 7 w p 1 6 w p 3 1 w p 3 0 w p 2 9 w p 2 8 w p 2 7 w p 2 6 w p 2 5 w p 2 4 p r o t e c t i o n k e y 0 x 3 f f f 0 x 3 f f e 0 x 3 f f d 0 x 3 f f c 0 x 3 f f b 0 x 3 f f a 0 x 3 f f 9 0 x 3 e 0 0 w d o g l o c k 0 7 3 2 7 - 0 8 1 f i g u r e 8 1 . f l a s h p r o t e c t i o n i n p a g e 3 1 t h e s e q u e n c e f o r w r i t i n g t h e p r o t e c t i o n b i t s i s a s f o l l o w s : 1 . s e t u p t h e e a d r h , e a d r l , p r o t b 1 , a n d p r o t b 0 r e g i s t e r s w i t h t h e w r i t e / e r a s e p r o t e c t i o n b i t s . w h e n e r a s e d , t h e p r o t e c t i o n b i t s d e f a u l t t o 1 ( l i k e a n y o t h e r b i t o f f l a s h m e m o r y ) . t h e d e f a u l t p r o t e c t i o n s e t t i n g i s f o r n o p r o t e c t i o n . t o e n a b l e p r o t e c t i o n , w r i t e a 0 t o t h e b i t s c o r r e s p o n d i n g t o t h e p a g e s t h a t s h o u l d b e p r o t e c t e d . 2 . s e t u p t h e p r o t r r e g i s t e r w i t h t h e r e a d p r o t e c t i o n b i t s . n o t e t h a t e v e r y r e a d p r o t e c t i o n b i t p r o t e c t s f o u r p a g e s . t o e n a b l e t h e r e a d p r o t e c t i o n b i t , w r i t e a 0 t o t h e b i t s t h a t s h o u l d b e r e a d p r o t e c t e d . 3 . t o e n a b l e t h e p r o t e c t i o n k e y , w r i t e t o t h e p r o t k y r e g i s t e r . i f e n a b l e d , t h e p r o t e c t i o n k e y i s r e q u i r e d t o m o d i f y t h e p r o t e c t i o n s c h e m e . t h e p r o t e c t i o n k e y , f l a s h m e m o r y a d d r e s s 0 x 3 f f a , d e f a u l t s t o 0 x f f ; i f t h e p r o t k y r e g i s t e r i s n o t w r i t t e n t o , i t r e m a i n s 0 x f f . i f t h e p r o t e c t i o n k e y i s w r i t t e n t o , t h e p r o t k y r e g i s t e r m u s t b e w r i t t e n w i t h t h i s v a l u e e v e r y t i m e t h e p r o t e c t i o n f u n c t i o n a l i t y i s a c c e s s e d . n o t e t h a t o n c e t h e p r o t e c t i o n k e y i s c o n f i g u r e d , i t c a n n o t b e m o d i f i e d . a l s o , n o t e t h a t t h e m o s t s i g n i f i c a n t b i t o f a d d r e s s 0 x 3 f f a i s u s e d t o e n a b l e a l o c k m e c h a n i s m f o r t h e w a t c h d o g s e t t i n g s ( s e e t h e w a t c h d o g t i m e r s e c t i o n f o r m o r e i n f o r m a t i o n ) . 4 . r u n t h e p r o t e c t i o n c o m m a n d b y w r i t i n g 0 x 0 8 t o t h e e c o n r e g i s t e r . 5 . r e s e t t h e c h i p t o a c t i v a t e t h e n e w p r o t e c t i o n . t o e n a b l e r e a d a n d w r i t e / e r a s e p r o t e c t i o n f o r t h e l a s t p a g e o n l y , u s e t h e f o l l o w i n g 8 0 5 2 c o d e . w r i t i n g t h e f l a s h p r o t e c t i o n c o m m a n d t o t h e e c o n r e g i s t e r i n i t i a t e s p r o g r a m m i n g o f t h e p r o t e c t i o n b i t s i n t h e f l a s h . ; e n a b l e r e a d p r o t e c t i o n o n t h e l a s t f o u r p a g e s o n l y m o v p r o t r , # 0 7 f h ; s e t u p a p r o t e c t i o n k e y o f 0 a 3 h . t h i s c o m m a n d c a n b e ; o m i t t e d t o u s e t h e d e f a u l t p r o t e c t i o n k e y o f 0 x f f m o v p r o t k y , # 0 a 3 h ; w r i t e t h e f l a s h k e y t o t h e f l s h k y r e g i s t e r t o e n a b l e f l a s h ; a c c e s s . t h e f l a s h a c c e s s k e y i s n o t c o n f i g u r a b l e . m o v f l s h k y , # 3 b h ; w r i t e f l a s h p r o t e c t i o n c o m m a n d t o t h e e c o n r e g i s t e r m o v e c o n , # 0 8 h
a d e 7 5 1 8 r e v . 0 | p a g e 9 2 o f 1 2 8 e n a b l i n g f l a s h p r o t e c t i o n b y e m u l a t o r c o m m a n d s a n o t h e r w a y t o s e t t h e f l a s h p r o t e c t i o n b y t e s i s t o u s e s o m e r e s e r v e d e m u l a t o r c o m m a n d s a v a i l a b l e o n l y i n d o w n l o a d m o d e . t h e s e c o m m a n d s w r i t e d i r e c t l y t o t h e s f r s a n d c a n b e u s e d t o d u p l i c a t e t h e o p e r a t i o n m e n t i o n e d i n t h e e n a b l i n g f l a s h p r o t e c t i o n b y c o d e s e c t i o n . w h e n t h e s e f l a s h b y t e s a r e w r i t t e n , t h e p a r t c a n e x i t e m u l a t i o n m o d e b y a r e s e t a n d t h e p r o t e c t i o n s a r e e f f e c t i v e . t h i s m e t h o d c a n b e u s e d i n p r o d u c t i o n a n d i m p l e - m e n t e d a f t e r d o w n l o a d i n g t h e p r o g r a m . t h e c o m m a n d s u s e d f o r t h i s o p e r a t i o n a r e a n e x t e n s i o n o f t h e c o m m a n d s l i s t e d i n a p p l i c a t i o n n o t e u c 0 0 4 , u n d e r s t a n d i n g t h e s e r i a l d o w n l o a d p r o t o c o l , a v a i l a b l e a t w w w . a n a l o g . c o m . x c o m m a n d w i t h a s c i i c o d e i o r 0 x 4 9 w r i t e s t h e d a t a i n t o r 0 . x c o m m a n d w i t h a s c i i c o d e f o r 0 x 4 6 w r i t e s r 0 i n t o t h e s f r a d d r e s s d e f i n e d i n t h e d a t a o f t h i s c o m m a n d . b y o m i t t i n g t h e p r o t o c o l d e f i n e d i n a p p l i c a t i o n n o t e u c 0 0 4 , u n d e r s t a n d i n g t h e s e r i a l d o w n l o a d p r o t o c o l , t h e s e q u e n c e t o l o a d p r o t e c t i o n s i s s i m i l a r t o t h e s e q u e n c e p r e s e n t e d i n t h e e n a b l i n g f l a s h p r o t e c t i o n b y c o d e s e c t i o n , e x c e p t t h a t t w o e m u l a t o r c o m m a n d s a r e n e c e s s a r y t o r e p l a c e o n e a s s e m b l y c o m m a n d . f o r e x a m p l e , t o w r i t e t h e p r o t e c t i o n v a l u e i n e a d r h , t h e t w o f o l l o w i n g c o m m a n d s n e e d t o b e e x e c u t e d : x c o m m a n d i w i t h d a t a = v a l u e o f p r o t e c t i o n b y t e 0 x 3 f f f . x c o m m a n d f w i t h d a t a = 0 x c 7 . f o l l o w i n g t h i s p r o t o c o l , t h e p r o t e c t i o n c a n b e w r i t t e n t o t h e f l a s h u s i n g t h e s a m e s e q u e n c e a s m e n t i o n e d i n t h e e n a b l i n g f l a s h p r o t e c t i o n b y c o d e s e c t i o n . w h e n t h e p a r t i s r e s e t , t h e p r o t e c t i o n i s e f f e c t i v e . n o t e s o n f l a s h p r o t e c t i o n t h e f l a s h p r o t e c t i o n s c h e m e i s d i s a b l e d b y d e f a u l t s o t h a t n o n e o f t h e p a g e s o f t h e f l a s h a r e p r o t e c t e d f r o m r e a d i n g o r w r i t i n g / e r a s i n g . t h e l a s t p a g e m u s t b e r e a d a n d w r i t e / e r a s e p r o t e c t e d f o r t h e p r o t e c t i o n s c h e m e t o w o r k . t o a c t i v a t e t h e p r o t e c t i o n s e t t i n g s , t h e a d e 7 5 1 8 m u s t b e r e s e t a f t e r c o n f i g u r i n g t h e p r o t e c t i o n . a f t e r c o n f i g u r i n g p r o t e c t i o n o n t h e l a s t p a g e a n d r e s e t t i n g t h e p a r t , p r o t e c t i o n s t h a t h a v e b e e n e n a b l e d c a n o n l y b e r e m o v e d b y m a s s e r a s i n g t h e f l a s h m e m o r y . t h e p r o t e c t i o n b i t s a r e r e a d a n d e r a s e p r o t e c t e d b y e n a b l i n g r e a d a n d w r i t e / e r a s e p r o t e c t i o n o n t h e l a s t p a g e , b u t t h e p r o t e c t i o n b i t s a r e n e v e r t r u l y w r i t e p r o t e c t e d . p r o t e c t i o n b i t s c a n b e m o d i f i e d f r o m 1 t o 0 , e v e n a f t e r t h e l a s t p a g e h a s b e e n p r o t e c t e d . i n t h i s w a y , m o r e p r o t e c t i o n c a n b e a d d e d b u t n o n e c a n b e r e m o v e d . t h e p r o t e c t i o n s c h e m e i s i n t e n d e d t o p r o t e c t t h e e n d s y s t e m . p r o - t e c t i o n s h o u l d b e d i s a b l e d w h i l e d e v e l o p i n g a n d e m u l a t i n g c o d e . f l a s h m e m o r y t i m i n g t y p i c a l p r o g r a m a n d e r a s e t i m e s f o r t h e f l a s h m e m o r y a r e s h o w n i n t a b l e 9 0 . t a b l e 9 0 . f l a s h m e m o r y p r o g r a m a n d e r a s e t i m e s c o m m a n d b y t e s a f f e c t e d f l a s h m e m o r y t i m i n g w r i t e b y t e 1 b y t e 3 0 s e r a s e p a g e 5 1 2 b y t e s 2 0 m s e r a s e a l l 1 6 k b 2 0 0 m s r e a d b y t e 1 b y t e 1 0 0 n s e r a s e p a g e a n d w r i t e b y t e 5 1 2 b y t e s 2 1 m s v e r i f y b y t e 1 b y t e 1 0 0 n s n o t e t h a t t h e c o r e m i c r o c o n t r o l l e r o p e r a t i o n i s i d l e d u n t i l t h e r e q u e s t e d f l a s h m e m o r y o p e r a t i o n i s c o m p l e t e . i n p r a c t i c e , t h i s m e a n s t h a t e v e n t h o u g h t h e f l a s h o p e r a t i o n i s t y p i c a l l y i n i t i a t e d w i t h a t w o - m a c h i n e - c y c l e m o v i n s t r u c t i o n t o w r i t e t o t h e f l a s h c o n t r o l s f r ( e c o n , 0 x b 9 ) , t h e n e x t i n s t r u c t i o n i s n o t e x e c u t e d u n t i l t h e f l a s h / e e o p e r a t i o n i s c o m p l e t e . t h i s m e a n s t h a t t h e c o r e c a n n o t r e s p o n d t o i n t e r r u p t r e q u e s t s u n t i l t h e f l a s h / e e o p e r a t i o n i s c o m p l e t e , a l t h o u g h t h e c o r e p e r i p h e r a l f u n c t i o n s , s u c h a s c o u n t e r s a n d t i m e r s , c o n t i n u e t o c o u n t a s c o n f i g u r e d t h r o u g h o u t t h i s p e r i o d . i n - c i r c u i t p r o g r a m m i n g s e r i a l d o w n l o a d i n g t h e a d e 7 5 1 8 f a c i l i t a t e s c o d e d o w n l o a d v i a t h e s t a n d a r d u a r t s e r i a l p o r t . t h e p a r t s e n t e r s e r i a l d o w n l o a d m o d e a f t e r a r e s e t o r a p o w e r c y c l e i f t h e s d e n p i n i s p u l l e d l o w t h r o u g h a n e x t e r n a l 1 k r e s i s t o r . w h e n i n s e r i a l d o w n l o a d m o d e , t h e h i d d e n e m b e d - d e d d o w n l o a d k e r n e l e x e c u t e s . t h i s a l l o w s t h e u s e r t o d o w n l o a d c o d e t o t h e f u l l 1 6 k b o f f l a s h m e m o r y w h i l e t h e d e v i c e i s i n - c i r c u i t i n i t s t a r g e t a p p l i c a t i o n h a r d w a r e . p r o t e c t i o n c o n f i g u r e d i n t h e l a s t p a g e o f t h e a d e 7 5 1 8 a f f e c t s w h e t h e r f l a s h m e m o r y c a n b e a c c e s s e d i n s e r i a l d o w n l o a d m o d e . r e a d p r o t e c t e d p a g e s c a n n o t b e r e a d . w r i t e / e r a s e p r o t e c t e d p a g e s c a n n o t b e w r i t t e n o r e r a s e d .
a d e 7 5 1 8 r e v . 0 | p a g e 9 3 o f 1 2 8 t i m e r s t h e a d e 7 5 1 8 h a s t h r e e 1 6 - b i t t i m e r / c o u n t e r s : t i m e r / c o u n t e r 0 , t i m e r / c o u n t e r 1 , a n d t i m e r / c o u n t e r 2 . t h e t i m e r / c o u n t e r h a r d w a r e i s i n c l u d e d o n c h i p t o r e l i e v e t h e p r o c e s s o r c o r e o f o v e r h e a d i n h e r e n t i n i m p l e m e n t i n g t i m e r / c o u n t e r f u n c t i o n a l i t y i n s o f t w a r e . e a c h t i m e r / c o u n t e r c o n s i s t s o f t w o 8 - b i t r e g i s t e r s : t h x a n d t l x ( x = 0 , 1 , o r 2 ) . a l l t h r e e t i m e r s c a n b e c o n f i g u r e d t o o p e r a t e a s t i m e r s o r a s e v e n t c o u n t e r s . w h e n f u n c t i o n i n g a s a t i m e r , t h e t l x r e g i s t e r i s i n c r e m e n t e d e v e r y m a c h i n e c y c l e . t h u s , u s e r s c a n t h i n k o f i t a s c o u n t i n g m a c h i n e c y c l e s . b e c a u s e a m a c h i n e c y c l e o n a s i n g l e c y c l e c o r e c o n s i s t s o f o n e c o r e c l o c k p e r i o d , t h e m a x i m u m c o u n t r a t e i s t h e c o r e c l o c k f r e q u e n c y . w h e n f u n c t i o n i n g a s a c o u n t e r , t h e t l x r e g i s t e r i s i n c r e m e n t e d b y a 1 - t o - 0 t r a n s i t i o n a t i t s c o r r e s p o n d i n g e x t e r n a l i n p u t p i n : t 0 , t 1 , o r t 2 . w h e n t h e s a m p l e s s h o w a h i g h i n o n e c y c l e a n d a l o w i n t h e n e x t c y c l e , t h e c o u n t i s i n c r e m e n t e d . b e c a u s e i t t a k e s t w o m a c h i n e c y c l e s ( t w o c o r e c l o c k p e r i o d s ) t o r e c o g n i z e a 1 - t o - 0 t r a n s i t i o n , t h e m a x i m u m c o u n t r a t e i s h a l f t h e c o r e c l o c k f r e q u e n c y . t h e r e a r e n o r e s t r i c t i o n s o n t h e d u t y c y c l e o f t h e e x t e r n a l i n p u t s i g n a l , b u t t o e n s u r e t h a t a g i v e n l e v e l i s s a m p l e d a t l e a s t o n c e b e f o r e i t c h a n g e s , i t m u s t b e h e l d f o r a m i n i m u m o f o n e f u l l m a c h i n e c y c l e . u s e r c o n f i g u r a t i o n a n d c o n t r o l o f a l l t i m e r o p e r a t i n g m o d e s i s a c h i e v e d v i a t h e s f r s l i s t e d i n t a b l e 9 1 . t a b l e 9 1 . t i m e r s f r s s f r a d d r e s s b i t a d d r e s s a b l e d e s c r i p t i o n t c o n 0 x 8 8 y e s t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 c o n t r o l ( s e e t a b l e 9 3 ) . t m o d 0 x 8 9 n o t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 m o d e ( s e e t a b l e 9 2 ) . t l 0 0 x 8 a n o t i m e r 0 l o w b y t e ( s e e t a b l e 9 6 ) . t l 1 0 x 8 b n o t i m e r 1 l o w b y t e ( s e e t a b l e 9 8 ) . t h 0 0 x 8 c n o t i m e r 0 h i g h b y t e ( s e e t a b l e 9 5 ) . t h 1 0 x 8 d n o t i m e r 1 h i g h b y t e ( s e e t a b l e 9 7 ) . t 2 c o n 0 x c 8 y e s t i m e r / c o u n t e r 2 c o n t r o l ( s e e t a b l e 9 4 ) . r c a p 2 l 0 x c a n o t i m e r 2 r e l o a d / c a p t u r e l o w b y t e ( s e e t a b l e 1 0 2 ) . r c a p 2 h 0 x c b n o t i m e r 2 r e l o a d / c a p t u r e h i g h b y t e ( s e e t a b l e 1 0 1 ) . t l 2 0 x c c n o t i m e r 2 l o w b y t e ( s e e t a b l e 1 0 0 ) . t h 2 0 x c d n o t i m e r 2 h i g h b y t e ( s e e t a b l e 9 9 ) . t i m e r r e g i s t e r s t a b l e 9 2 . t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 m o d e s f r ( t m o d , 0 x 8 9 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 g a t e 1 0 t i m e r 1 g a t i n g c o n t r o l . s e t b y s o f t w a r e t o e n a b l e t i m e r / c o u n t e r 1 o n l y w h e n t h e i n t 1 p i n i s h i g h a n d t h e t r 1 c o n t r o l i s s e t . c l e a r e d b y s o f t w a r e t o e n a b l e t i m e r 1 w h e n e v e r t h e t r 1 c o n t r o l b i t i s s e t . 6 c / t 1 0 t i m e r 1 t i m e r o r c o u n t e r s e l e c t b i t . s e t b y s o f t w a r e t o s e l e c t c o u n t e r o p e r a t i o n ( i n p u t f r o m t h e t 1 p i n ) . c l e a r e d b y s o f t w a r e t o s e l e c t t h e t i m e r o p e r a t i o n ( i n p u t f r o m t h e i n t e r n a l s y s t e m c l o c k ) . 5 t o 4 t 1 / m 1 , t 1 / m 0 0 0 t i m e r 1 m o d e s e l e c t b i t s . t 1 / m [ 1 : 0 ] r e s u l t 0 0 t h 1 o p e r a t e s a s a n 8 - b i t t i m e r / c o u n t e r . t l 1 s e r v e s a s a 5 - b i t p r e s c a l e r . 0 1 1 6 - b i t t i m e r / c o u n t e r . t h 1 a n d t l 1 a r e c a s c a d e d ; t h e r e i s n o p r e s c a l e r . 1 0 8 - b i t a u t o r e l o a d t i m e r / c o u n t e r . t h 1 h o l d s a v a l u e t o r e l o a d i n t o t l 1 e a c h t i m e i t o v e r f l o w s . 1 1 t i m e r / c o u n t e r 1 s t o p p e d . 3 g a t e 0 0 t i m e r 0 g a t i n g c o n t r o l . s e t b y s o f t w a r e t o e n a b l e t i m e r / c o u n t e r 0 o n l y w h e n t h e i n t 0 p i n i s h i g h a n d t h e t r 0 c o n t r o l b i t i s s e t . c l e a r e d b y s o f t w a r e t o e n a b l e t i m e r 0 w h e n e v e r t h e t r 0 c o n t r o l b i t i s s e t . 2 c / t 0 0 t i m e r 0 t i m e r o r c o u n t e r s e l e c t b i t . s e t b y s o f t w a r e t o t h e s e l e c t c o u n t e r o p e r a t i o n ( i n p u t f r o m t h e t 0 p i n ) . c l e a r e d b y s o f t w a r e t o t h e s e l e c t t i m e r o p e r a t i o n ( i n p u t f r o m t h e i n t e r n a l s y s t e m c l o c k ) . 1 t o 0 t 0 / m 1 , t 0 / m 0 0 0 t i m e r 0 m o d e s e l e c t b i t s . t 0 / m [ 1 : 0 ] r e s u l t 0 0 t h 0 o p e r a t e s a s a n 8 - b i t t i m e r / c o u n t e r . t l 0 s e r v e s a s a 5 - b i t p r e s c a l e r . 0 1 1 6 - b i t t i m e r / c o u n t e r . t h 0 a n d t l 0 a r e c a s c a d e d ; t h e r e i s n o p r e s c a l e r . 1 0 8 - b i t a u t o r e l o a d t i m e r / c o u n t e r . t h 0 h o l d s a v a l u e t o r e l o a d i n t o t l 0 e a c h t i m e i t o v e r f l o w s . 1 1 t l 0 i s a n 8 - b i t t i m e r / c o u n t e r c o n t r o l l e d b y t h e s t a n d a r d t i m e r 0 c o n t r o l b i t s . t h 0 i s a n 8 - b i t t i m e r o n l y , c o n t r o l l e d b y t i m e r 1 c o n t r o l b i t s .
a d e 7 5 1 8 r e v . 0 | p a g e 9 4 o f 1 2 8 t a b l e 9 3 . t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 c o n t r o l s f r ( t c o n , 0 x 8 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 x 8 f t f 1 0 t i m e r 1 o v e r f l o w f l a g . s e t b y h a r d w a r e o n a t i m e r / c o u n t e r 1 o v e r f l o w . c l e a r e d b y h a r d w a r e w h e n t h e p r o g r a m c o u n t e r ( p c ) v e c t o r s t o t h e i n t e r r u p t s e r v i c e r o u t i n e . 6 0 x 8 e t r 1 0 t i m e r 1 r u n c o n t r o l b i t . s e t b y t h e u s e r t o t u r n o n t i m e r / c o u n t e r 1 . c l e a r e d b y t h e u s e r t o t u r n o f f t i m e r / c o u n t e r 1 . 5 0 x 8 d t f 0 0 t i m e r 0 o v e r f l o w f l a g . s e t b y h a r d w a r e o n a t i m e r / c o u n t e r 0 o v e r f l o w . c l e a r e d b y h a r d w a r e w h e n t h e p c v e c t o r s t o t h e i n t e r r u p t s e r v i c e r o u t i n e . 4 0 x 8 c t r 0 0 t i m e r 0 r u n c o n t r o l b i t . s e t b y t h e u s e r t o t u r n o n t i m e r / c o u n t e r 0 . c l e a r e d b y t h e u s e r t o t u r n o f f t i m e r / c o u n t e r 0 . 3 0 x 8 b i e 1 1 0 e x t e r n a l i n t e r r u p t 1 ( i n t 1 ) f l a g . s e t b y h a r d w a r e b y a f a l l i n g e d g e o r b y a z e r o l e v e l a p p l i e d t o t h e e x t e r n a l i n t e r r u p t p i n , i n t 1 , d e p e n d i n g o n t h e s t a t e o f b i t i t 1 . c l e a r e d b y h a r d w a r e w h e n t h e p c v e c t o r s t o t h e i n t e r r u p t s e r v i c e r o u t i n e o n l y i f t h e i n t e r r u p t w a s t r a n s i t i o n a c t i v a t e d . i f l e v e l a c t i v a t e d , t h e e x t e r n a l r e q u e s t i n g s o u r c e c o n t r o l s t h e r e q u e s t f l a g r a t h e r t h a n t h e o n - c h i p h a r d w a r e . 2 0 x 8 a i t 1 1 0 e x t e r n a l i n t e r r u p t 1 ( i e 1 ) t r i g g e r t y p e . s e t b y s o f t w a r e t o s p e c i f y e d g e s e n s i t i v e d e t e c t i o n , t h a t i s , 1 - t o - 0 t r a n s i t i o n . c l e a r e d b y s o f t w a r e t o s p e c i f y l e v e l s e n s i t i v e d e t e c t i o n , t h a t i s , z e r o l e v e l . 1 0 x 8 9 i e 0 1 0 e x t e r n a l i n t e r r u p t 0 ( i n t 0 ) f l a g . s e t b y h a r d w a r e b y a f a l l i n g e d g e o r b y a z e r o l e v e l b e i n g a p p l i e d t o t h e e x t e r n a l i n t e r r u p t p i n , i n t 0 , d e p e n d i n g o n t h e s t a t e o f b i t i t 0 . c l e a r e d b y h a r d w a r e w h e n t h e p c v e c t o r s t o t h e i n t e r r u p t s e r v i c e r o u t i n e o n l y i f t h e i n t e r r u p t w a s t r a n s i t i o n a c t i v a t e d . i f l e v e l a c t i v a t e d , t h e e x t e r n a l r e q u e s t i n g s o u r c e c o n t r o l s t h e r e q u e s t f l a g r a t h e r t h a n t h e o n - c h i p h a r d w a r e . 0 0 x 8 8 i t 0 1 0 e x t e r n a l i n t e r r u p t 0 ( i e 0 ) t r i g g e r t y p e . s e t b y s o f t w a r e t o s p e c i f y e d g e s e n s i t i v e d e t e c t i o n , t h a t i s , 1 - t o - 0 t r a n s i t i o n . c l e a r e d b y s o f t w a r e t o s p e c i f y l e v e l s e n s i t i v e d e t e c t i o n , t h a t i s , z e r o l e v e l . 1 t h e s e b i t s a r e n o t u s e d t o c o n t r o l t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 b u t a r e i n s t e a d u s e d t o c o n t r o l a n d m o n i t o r t h e e x t e r n a l i n t 0 a n d i n t 1 i n t e r r u p t p i n s . t a b l e 9 4 . t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 x c f t f 2 0 t i m e r 2 o v e r f l o w f l a g . s e t b y h a r d w a r e o n a t i m e r 2 o v e r f l o w . t f 2 c a n n o t b e s e t w h e n e i t h e r r c l k = 1 o r t c l k = 1 . c l e a r e d b y u s e r s o f t w a r e . 6 0 x c e e x f 2 0 t i m e r 2 e x t e r n a l f l a g . s e t b y h a r d w a r e w h e n e i t h e r a c a p t u r e o r r e l o a d i s c a u s e d b y a n e g a t i v e t r a n s i t i o n o n t 2 e x p i n a n d e x e n 2 = 1 . c l e a r e d b y u s e r s o f t w a r e . 5 0 x c d r c l k 0 r e c e i v e c l o c k e n a b l e b i t . s e t b y t h e u s e r t o e n a b l e t h e s e r i a l p o r t t o u s e t i m e r 2 o v e r f l o w p u l s e s f o r i t s r e c e i v e c l o c k i n s e r i a l p o r t m o d e 1 a n d s e r i a l p o r t m o d e 3 . c l e a r e d b y t h e u s e r t o e n a b l e t i m e r 1 o v e r f l o w t o b e u s e d f o r t h e r e c e i v e c l o c k . 4 0 x c c t c l k 0 t r a n s m i t c l o c k e n a b l e b i t . s e t b y t h e u s e r t o e n a b l e t h e s e r i a l p o r t t o u s e t i m e r 2 o v e r f l o w p u l s e s f o r i t s t r a n s m i t c l o c k i n s e r i a l p o r t m o d e 1 a n d s e r i a l p o r t m o d e 3 . c l e a r e d b y t h e u s e r t o e n a b l e t i m e r 1 o v e r f l o w t o b e u s e d f o r t h e t r a n s m i t c l o c k . 3 0 x c b e x e n 2 0 t i m e r 2 e x t e r n a l e n a b l e f l a g . s e t b y t h e u s e r t o e n a b l e a c a p t u r e o r r e l o a d t o o c c u r a s a r e s u l t o f a n e g a t i v e t r a n s i t i o n o n t 2 e x i f t i m e r 2 i s n o t b e i n g u s e d t o c l o c k t h e s e r i a l p o r t . c l e a r e d b y t h e u s e r f o r t i m e r 2 t o i g n o r e e v e n t s a t t 2 e x . 2 0 x c a t r 2 0 t i m e r 2 s t a r t / s t o p c o n t r o l b i t . s e t b y t h e u s e r t o s t a r t t i m e r 2 . c l e a r e d b y t h e u s e r t o s t o p t i m e r 2 . 1 0 x c 9 c / t 2 0 t i m e r 2 t i m e r o r c o u n t e r f u n c t i o n s e l e c t b i t . s e t b y t h e u s e r t o s e l e c t t h e c o u n t e r f u n c t i o n ( i n p u t f r o m e x t e r n a l t 2 p i n ) . c l e a r e d b y t h e u s e r t o s e l e c t t h e t i m e r f u n c t i o n ( i n p u t f r o m o n - c h i p c o r e c l o c k ) . 0 0 x c 8 c a p 2 0 t i m e r 2 c a p t u r e / r e l o a d s e l e c t b i t . s e t b y t h e u s e r t o e n a b l e c a p t u r e s o n n e g a t i v e t r a n s i t i o n s a t t 2 e x i f e x e n 2 = 1 . c l e a r e d b y t h e u s e r t o e n a b l e a u t o r e l o a d s w i t h t i m e r 2 o v e r f l o w s o r n e g a t i v e t r a n s i t i o n s a t t 2 e x w h e n e x e n 2 = 1 . w h e n e i t h e r r c l k = 1 o r t c l k = 1 , t h i s b i t i s i g n o r e d a n d t h e t i m e r i s f o r c e d t o a u t o r e l o a d o n t i m e r 2 o v e r f l o w .
a d e 7 5 1 8 r e v . 0 | p a g e 9 5 o f 1 2 8 t a b l e 9 5 . t i m e r 0 h i g h b y t e s f r ( t h 0 , 0 x 8 c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t h 0 0 t i m e r 0 d a t a h i g h b y t e . t a b l e 9 6 . t i m e r 0 l o w b y t e s f r ( t l 0 , 0 x 8 a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t l 0 0 t i m e r 0 d a t a l o w b y t e . t a b l e 9 7 . t i m e r 1 h i g h b y t e s f r ( t h 1 , 0 x 8 d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t h 1 0 t i m e r 1 d a t a h i g h b y t e . t a b l e 9 8 . t i m e r 1 l o w b y t e s f r ( t l 1 , 0 x 8 b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t l 1 0 t i m e r 1 d a t a l o w b y t e . t a b l e 9 9 . t i m e r 2 h i g h b y t e s f r ( t h 2 , 0 x c d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t h 2 0 t i m e r 2 d a t a h i g h b y t e . t a b l e 1 0 0 . t i m e r 2 l o w b y t e s f r ( t l 2 , 0 x c c ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t l 2 0 t i m e r 2 d a t a l o w b y t e . t a b l e 1 0 1 . t i m e r 2 r e l o a d / c a p t u r e h i g h b y t e s f r ( r c a p 2 h , 0 x c b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t h 2 0 t i m e r 2 r e l o a d / c a p t u r e h i g h b y t e . t a b l e 1 0 2 . t i m e r 2 r e l o a d / c a p t u r e l o w b y t e s f r ( r c a p 2 l , 0 x c a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t l 2 0 t i m e r 2 r e l o a d / c a p t u r e l o w b y t e . t i m e r 0 a n d t i m e r 1 t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 d a t a r e g i s t e r s e a c h t i m e r c o n s i s t s o f t w o 8 - b i t r e g i s t e r s . t h e y a r e t i m e r 0 h i g h b y t e s f r ( t h 0 , 0 x 8 c ) , t i m e r 0 l o w b y t e s f r ( t l 0 , 0 x 8 a ) , t i m e r 1 h i g h b y t e s f r ( t h 1 , 0 x 8 d ) , a n d t i m e r 1 l o w b y t e s f r ( t l 1 , 0 x 8 b ) . t h e s e c a n b e u s e d a s i n d e p e n d e n t r e g i s t e r s o r c o m b i n e d i n t o a s i n g l e 1 6 - b i t r e g i s t e r , d e p e n d i n g o n t h e t i m e r m o d e c o n f i g u r a t i o n ( s e e t a b l e 9 5 t o t a b l e 9 8 ) . t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 o p e r a t i n g m o d e s t h i s s e c t i o n d e s c r i b e s t h e o p e r a t i n g m o d e s f o r t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 . u n l e s s o t h e r w i s e n o t e d , t h e s e m o d e s o f o p e r a t i o n a r e t h e s a m e f o r b o t h t i m e r 0 a n d t i m e r 1 . m o d e 0 ( 1 3 - b i t t i m e r / c o u n t e r ) m o d e 0 c o n f i g u r e s a n 8 - b i t t i m e r / c o u n t e r . f i g u r e 8 2 s h o w s m o d e 0 o p e r a t i o n . n o t e t h a t t h e d i v i d e - b y - 1 2 p r e s c a l e r i s n o t p r e s e n t o n t h e s i n g l e c y c l e c o r e . c o n t r o l t r 0 t f 0 t l 0 ( 5 b i t s ) t h 0 ( 8 b i t s ) i n t e r r u p t p 0 . 6 / t 0 g a t e i n t 0 f c o r e c / t 0 = 0 c / t 0 = 1 0 7 3 2 7 - 0 8 2 f i g u r e 8 2 . t i m e r / c o u n t e r 0 , m o d e 0 i n t h i s m o d e , t h e t i m e r r e g i s t e r i s c o n f i g u r e d a s a 1 3 - b i t r e g i s t e r . a s t h e c o u n t r o l l s o v e r f r o m a l l 1 s t o a l l 0 s , i t s e t s t h e t i m e r o v e r f l o w f l a g , t f 0 . t f 0 c a n t h e n b e u s e d t o r e q u e s t a n i n t e r r u p t . t h e c o u n t e d i n p u t i s e n a b l e d t o t h e t i m e r w h e n t r 0 = 1 a n d e i t h e r g a t e 0 = 0 o r i n t 0 = 1 . s e t t i n g g a t e 0 = 1 a l l o w s t h e t i m e r t o b e c o n t r o l l e d b y e x t e r n a l i n p u t i n t 0 t o f a c i l i t a t e p u l s e w i d t h m e a s u r e m e n t s . t r 0 i s a c o n t r o l b i t i n t h e t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 c o n t r o l s f r ( t c o n , 0 x 8 8 ) ; t h e g a t e 0 / g a t e 1 b i t s a r e i n t h e t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 m o d e s f r ( t m o d , 0 x 8 9 ) . t h e 1 3 - b i t r e g i s t e r c o n s i s t s o f a l l e i g h t b i t s o f t i m e r 0 h i g h b y t e s f r ( t h 0 , 0 x 8 c ) a n d t h e l o w e r f i v e b i t s o f t i m e r 0 l o w b y t e s f r ( t l 0 , 0 x 8 a ) . t h e u p p e r t h r e e b i t s o f t h e t l 0 s f r a r e i n d e t e r m i n a t e a n d s h o u l d b e i g n o r e d . s e t t i n g t h e r u n f l a g ( t r 0 ) d o e s n o t c l e a r t h e r e g i s t e r s . m o d e 1 ( 1 6 - b i t t i m e r / c o u n t e r ) m o d e 1 i s t h e s a m e a s m o d e 0 e x c e p t t h a t t h e m o d e 1 t i m e r r e g i s t e r r u n s w i t h a l l 1 6 b i t s . m o d e 1 i s s h o w n i n f i g u r e 8 3 . c o n t r o l t r 0 t f 0 t l 0 ( 8 b i t s ) t h 0 ( 8 b i t s ) i n t e r r u p t 0 p 0 . 6 / t 0 g a t e i n t c / t 0 = 0 c / t 0 = 1 f c o r e 0 7 3 2 7 - 0 8 3 f i g u r e 8 3 . t i m e r / c o u n t e r 0 , m o d e 1
a d e 7 5 1 8 r e v . 0 | p a g e 9 6 o f 1 2 8 m o d e 2 ( 8 - b i t t i m e r / c o u n t e r w i t h a u t o r e l o a d ) m o d e 2 c o n f i g u r e s t h e t i m e r r e g i s t e r a s a n 8 - b i t c o u n t e r ( t l 0 ) w i t h a u t o m a t i c r e l o a d , a s s h o w n i n f i g u r e 8 4 . o v e r f l o w f r o m t l 0 n o t o n l y s e t s t f 0 b u t a l s o r e l o a d s t l 0 w i t h t h e c o n t e n t s o f t h 0 , w h i c h i s p r e s e t b y s o f t w a r e . t h e r e l o a d l e a v e s t h 0 u n c h a n g e d . c o n t r o l t f 0 t l 0 ( 8 b i t s ) i n t e r r u p t r e l o a d t h 0 ( 8 b i t s ) t r 0 p 0 . 6 / t 0 g a t e i n t 0 c / t 0 = 0 c / t 0 = 1 f c o r e 0 7 3 2 7 - 0 8 4 f i g u r e 8 4 . t i m e r / c o u n t e r 0 , m o d e 2 m o d e 3 ( t w o 8 - b i t t i m e r / c o u n t e r s ) m o d e 3 h a s d i f f e r e n t e f f e c t s o n t i m e r 0 a n d t i m e r 1 . t i m e r 1 i n m o d e 3 s i m p l y h o l d s i t s c o u n t . t h e e f f e c t i s t h e s a m e a s s e t t i n g t r 1 = 0 . t i m e r 0 i n m o d e 3 e s t a b l i s h e s t l 0 a n d t h 0 a s t w o s e p a r a t e c o u n t e r s . t h i s c o n f i g u r a t i o n i s s h o w n i n f i g u r e 8 5 . t l 0 u s e s t h e t i m e r 0 c o n t r o l b i t s , c / t 0 , g a t e 0 ( s e e t a b l e 9 2 ) , t r 0 , t f 0 ( s e e t a b l e 9 3 ) , a n d i n t 0 . t h 0 i s l o c k e d i n t o a t i m e r f u n c t i o n ( c o u n t i n g m a c h i n e c y c l e s ) a n d t a k e s o v e r t h e u s e o f t r 1 a n d t f 1 f r o m t i m e r 1 . t h e r e f o r e , t h 0 c o n t r o l s t h e t i m e r 1 i n t e r r u p t . m o d e 3 i s p r o v i d e d f o r a p p l i c a t i o n s r e q u i r i n g a n e x t r a 8 - b i t t i m e r o r c o u n t e r . w h e n t i m e r 0 i s i n m o d e 3 , t i m e r 1 c a n b e t u r n e d o n a n d o f f b y s w i t c h i n g i t o u t o f a n d i n t o i t s o w n m o d e 3 , o r i t c a n b e u s e d b y t h e s e r i a l i n t e r f a c e a s a b a u d r a t e g e n e r a t o r . i n f a c t , t i m e r 1 c a n b e u s e d i n a n y a p p l i c a t i o n n o t r e q u i r i n g a n i n t e r r u p t f r o m t i m e r 1 i t s e l f . c o n t r o l c o r e c l k / 1 2 t f 0 t l 0 ( 8 b i t s ) i n t e r r u p t p 0 . 6 / t 0 g a t e t r 0 t f 1 t h 0 ( 8 b i t s ) i n t e r r u p t f c o r e / 1 2 t r 1 0 i n t f c o r e 0 7 3 2 7 - 0 8 5 c / t 0 = 0 c / t 0 = 1 f i g u r e 8 5 . t i m e r / c o u n t e r 0 , m o d e 3 t i m e r 2 t i m e r / c o u n t e r 2 d a t a r e g i s t e r s t i m e r / c o u n t e r 2 a l s o h a s t w o p a i r s o f 8 - b i t d a t a r e g i s t e r s a s s o - c i a t e d w i t h i t : t i m e r 2 h i g h b y t e s f r ( t h 2 , 0 x c d ) , t i m e r 2 l o w b y t e s f r ( t l 2 , 0 x c c ) , t i m e r 2 r e l o a d / c a p t u r e h i g h b y t e s f r ( r c a p 2 h , 0 x c b ) , a n d t i m e r 2 r e l o a d / c a p t u r e l o w b y t e s f r ( r c a p 2 l , 0 x c a ) . t h e s e a r e u s e d a s b o t h t i m e r d a t a r e g i s t e r s a n d a s t i m e r c a p t u r e / r e l o a d r e g i s t e r s ( s e e t a b l e 9 9 t o t a b l e 1 0 2 ) . t i m e r / c o u n t e r 2 o p e r a t i n g m o d e s t h e f o l l o w i n g s e c t i o n s d e s c r i b e t h e o p e r a t i n g m o d e s f o r t i m e r / c o u n t e r 2 . t h e o p e r a t i n g m o d e s a r e s e l e c t e d b y b i t s i n t h e t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) , a s s h o w n i n t a b l e 9 4 a n d t a b l e 1 0 3 . t a b l e 1 0 3 . t 2 c o n o p e r a t i n g m o d e s r c l k o r t c l k c a p 2 t r 2 m o d e 0 0 1 1 6 - b i t a u t o r e l o a d 0 1 1 1 6 - b i t c a p t u r e 1 x 1 b a u d r a t e x x 0 o f f 1 6 - b i t a u t o r e l o a d m o d e a u t o r e l o a d m o d e h a s t w o o p t i o n s t h a t a r e s e l e c t e d b y b i t e x e n 2 i n t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) . i f e x e n 2 = 0 w h e n t i m e r 2 r o l l s o v e r , i t n o t o n l y s e t s t f 2 b u t a l s o c a u s e s t h e t i m e r 2 r e g i s t e r s t o b e r e l o a d e d w i t h t h e 1 6 - b i t v a l u e i n b o t h t h e t i m e r 2 r e l o a d / c a p t u r e h i g h b y t e s f r ( r c a p 2 h , 0 x c b ) a n d t i m e r 2 r e l o a d / c a p t u r e l o w b y t e s f r ( r c a p 2 l , 0 x c a ) r e g i s t e r s , w h i c h a r e p r e s e t b y s o f t w a r e . i f e x e n 2 = 1 , t i m e r 2 p e r f o r m s t h e s a m e e v e n t s a s w h e n e x e n 2 = 0 b u t a d d s a 1 - t o - 0 t r a n s i t i o n a t t h e e x t e r n a l i n p u t t 2 e x , w h i c h t r i g g e r s t h e 1 6 - b i t r e l o a d a n d s e t s e x f 2 . a u t o r e l o a d m o d e i s s h o w n i n f i g u r e 8 6 . 1 6 - b i t c a p t u r e m o d e c a p t u r e m o d e h a s t w o o p t i o n s t h a t a r e s e l e c t e d b y b i t e x e n 2 i n t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) . i f e x e n 2 = 0 , t i m e r 2 i s a 1 6 - b i t t i m e r o r c o u n t e r t h a t , u p o n o v e r f l o w i n g , s e t s b i t t f 2 , t h e t i m e r 2 o v e r f l o w b i t , w h i c h c a n b e u s e d t o g e n e r a t e a n i n t e r r u p t . i f e x e n 2 = 1 , t i m e r 2 p e r f o r m s t h e s a m e e v e n t s a s w h e n e x e n 2 = 0 b u t a d d s a l - t o - 0 t r a n s i t i o n o n e x t e r n a l i n p u t t 2 e x , w h i c h c a u s e s t h e c u r r e n t v a l u e i n t h e t i m e r 2 r e g i s t e r s , t l 2 a n d t h 2 , t o b e c a p t u r e d i n t o t h e r c a p 2 l a n d r c a p 2 h r e g i s t e r s , r e s p e c t i v e l y . i n a d d i t i o n , t h e t r a n s i t i o n a t t 2 e x c a u s e s b i t e x f 2 i n t 2 c o n t o b e s e t , a n d e x f 2 , l i k e t f 2 , c a n g e n e r a t e a n i n t e r r u p t . c a p t u r e m o d e i s s h o w n i n f i g u r e 8 7 . t h e b a u d r a t e g e n e r a t o r m o d e i s s e l e c t e d b y r c l k = 1 a n d / o r t c l k = 1 . i n e i t h e r c a s e , i f t i m e r 2 i s u s e d t o g e n e r a t e t h e b a u d r a t e , t h e t f 2 i n t e r r u p t f l a g d o e s n o t o c c u r . t h e r e f o r e , t i m e r 2 i n t e r r u p t s d o n o t o c c u r a n d d o n o t h a v e t o b e d i s a b l e d . i n t h i s m o d e , t h e e x f 2 f l a g c a n , h o w e v e r , s t i l l c a u s e i n t e r r u p t s t h a t c a n b e u s e d a s a t h i r d e x t e r n a l i n t e r r u p t . b a u d r a t e g e n e r a t i o n i s d e s c r i b e d a s p a r t o f t h e u a r t s e r i a l p o r t o p e r a t i o n i n t h e u a r t s e r i a l i n t e r f a c e s e c t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 9 7 o f 1 2 8 t r 2 c o n t r o l t l 2 ( 8 b i t s ) t h 2 ( 8 b i t s ) r e l o a d t f 2 e x f 2 t i m e r i n t e r r u p t e x e n 2 c o n t r o l t r a n s i t i o n d e t e c t o r r c a p 2 l r c a p 2 h c / t 2 = 0 p 1 . 4 / t 2 p 1 . 3 / t 2 e x c / t 2 = 1 f c o r e 0 7 3 2 7 - 0 8 6 f i g u r e 8 6 . t i m e r / c o u n t e r 2 , 1 6 - b i t a u t o r e l o a d m o d e t f 2 p 1 . 4 / t 2 p 1 . 3 / t 2 e x t r 2 c o n t r o l t l 2 ( 8 b i t s ) t h 2 ( 8 b i t s ) c a p t u r e e x f 2 t i m e r i n t e r r u p t e x e n 2 c o n t r o l t r a n s i t i o n d e t e c t o r r c a p 2 l r c a p 2 h c / t 2 = 1 c / t 2 = 0 f c o r e 0 7 3 2 7 - 0 8 7 f i g u r e 8 7 . t i m e r / c o u n t e r 2 , 1 6 - b i t c a p t u r e m o d e
a d e 7 5 1 8 r e v . 0 | p a g e 9 8 o f 1 2 8 p l l t h e a d e 7 5 1 8 i s i n t e n d e d f o r u s e w i t h a 3 2 . 7 6 8 k h z w a t c h c r y s t a l . a p l l l o c k s o n t o a m u l t i p l e o f t h i s f r e q u e n c y t o p r o v i d e a s t a b l e 4 . 0 9 6 m h z c l o c k f o r t h e s y s t e m . t h e c o r e c a n o p e r a t e a t t h i s f r e q u e n c y o r a t b i n a r y s u b m u l t i p l e s o f i t t o a l l o w p o w e r s a v i n g s w h e n m a x i m u m c o r e p e r f o r m a n c e i s n o t r e q u i r e d . t h e d e f a u l t c o r e c l o c k i s t h e p l l c l o c k d i v i d e d b y 4 , o r 1 . 0 2 4 m h z . t h e a d e e n e r g y m e a s u r e m e n t c l o c k i s d e r i v e d f r o m t h e p l l c l o c k a n d i s m a i n t a i n e d a t 4 . 0 9 6 m h z / 5 m h z , o r 8 1 9 . 2 k h z , a c r o s s a l l c d s e t t i n g s . t h e p l l i s c o n t r o l l e d b y t h e c d [ 2 : 0 ] b i t s i n t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) . t o p r o t e c t e r r o n e o u s c h a n g e s t o t h e p o w c o n s r f , a k e y i s r e q u i r e d t o m o d i f y t h e r e g i s t e r . f i r s t , t h e k e y s f r ( k y r e g , 0 x c 1 ) i s w r i t t e n w i t h t h e k e y , 0 x a 7 , a n d t h e n a n e w v a l u e i s w r i t t e n t o t h e p o w c o n s f r . i f t h e p l l l o s e s l o c k , t h e m c u i s r e s e t a n d t h e p l l _ f l t b i t i s s e t i n t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) . s e t t h e p l l a c k b i t i n t h e s t a r t a d c m e a s u r e m e n t s f r ( a d c g o , 0 x d 8 ) t o a c k n o w l e d g e t h e p l l f a u l t , c l e a r i n g t h e p l l _ f l t b i t . p l l r e g i s t e r s t a b l e 1 0 4 . p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r e s e r v e d 1 r e s e r v e d . 6 m e t e r _ o f f 0 s e t t h i s b i t t o t u r n o f f t h e m o d u l a t o r s a n d e n e r g y m e t e r i n g d s p c i r c u i t r y t o r e d u c e p o w e r i f m e t e r i n g f u n c t i o n s a r e n o t n e e d e d i n p s m 0 . 5 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t a t 0 f o r p r o p e r o p e r a t i o n . 4 c o r e o f f 0 s e t t h i s b i t t o s h u t d o w n t h e c o r e i f i n p s m 1 o p e r a t i n g m o d e . 3 r e s e r v e d r e s e r v e d . 2 t o 0 c d [ 2 : 0 ] 0 1 0 c o n t r o l s t h e c o r e c l o c k f r e q u e n c y ( f c o r e ) . f c o r e = 4 . 0 9 6 m h z / 2 c d . c d [ 2 : 0 ] r e s u l t ( f c o r e i n m h z ) 0 0 0 4 . 0 9 6 0 0 1 2 . 0 4 8 0 1 0 1 . 0 2 4 0 1 1 0 . 5 1 2 1 0 0 0 . 2 5 6 1 0 1 0 . 1 2 8 1 1 0 0 . 0 6 4 1 1 1 0 . 0 3 2 w r i t i n g t o t h e p o w e r c o n t r o l s f r ( p o w c o n , 0 x c 5 ) n o t e t h a t w r i t i n g d a t a t o t h e p o w c o n s f r i n v o l v e s w r i t i n g 0 x a 7 i n t o t h e k e y s f r ( k y r e g , 0 x c 1 ) f o l l o w e d b y a w r i t e t o t h e p o w c o n s f r . t a b l e 1 0 5 . k e y s f r ( k y r e g , 0 x c 1 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 k y r e g 0 w r i t e 0 x a 7 t o t h e k y r e g s f r b e f o r e w r i t i n g t o t h e p o w c o n s f r t o u n l o c k i t . w r i t e 0 x e a t o t h e k y r e g s f r b e f o r e w r i t i n g t o t h e i n t p r , h t h s e c , s e c , m i n , o r h o u r t i m e k e e p i n g r e g i s t e r s t o u n l o c k i t .
a d e 7 5 1 8 r e v . 0 | p a g e 9 9 o f 1 2 8 t a b l e 1 0 6 . p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r x f l a g 0 i f t h i s b i t i s s e t , i n d i c a t e s t h a t a n r x e d g e e v e n t t r i g g e r e d w a k e - u p f r o m p s m 2 . 6 v s w s o u r c e 1 i n d i c a t e s t h e p o w e r s u p p l y t h a t i s c o n n e c t e d i n t e r n a l l y t o v s w o u t . i f t h i s b i t i s s e t , v s w o u t = v d d . i f t h i s b i t i s c l e a r e d , v s w o u t = v b a t . 5 v d d _ o k 1 i f t h i s b i t i s s e t , i n d i c a t e s t h a t v d d p o w e r s u p p l y i s a c c e p t a b l e f o r o p e r a t i o n . 4 p l l _ f l t 0 i f t h i s b i t i s s e t , i n d i c a t e s t h a t p l l i s n o t l o c k e d . 3 r e f _ b a t _ e n 0 i f t h i s b i t i s s e t , t h e i n t e r n a l v o l t a g e r e f e r e n c e i s e n a b l e d i n p s m 2 m o d e . 2 r e s e r v e d 0 t h i s b i t s h o u l d b e k e p t t o z e r o . 1 t o 0 r x p r o g [ 1 : 0 ] 0 0 c o n t r o l s t h e f u n c t i o n o f t h e p 1 . 0 / r x d p i n . r x p r o g [ 1 : 0 ] r e s u l t 0 0 g p i o 0 1 r x w i t h w a k e - u p d i s a b l e d 1 1 r x w i t h w a k e - u p e n a b l e d t a b l e 1 0 7 . s t a r t a d c m e a s u r e m e n t s f r ( a d c g o , 0 x d 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 x d f p l l _ f t l _ a c k 0 s e t t h i s b i t t o c l e a r t h e p l l f a u l t b i t , p l l _ f l t i n t h e p e r i p h r e g i s t e r . a p l l f a u l t i s g e n e r a t e d i f a r e s e t w a s c a u s e d b e c a u s e t h e p l l l o s t l o c k . 6 t o 0 0 x d e t o 0 x d 8 r e s e r v e d 0 r e s e r v e d .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 0 o f 1 2 8 r e a l - t i m e c l o c k t h e a d e 7 5 1 8 h a s a n e m b e d d e d r e a l - t i m e c l o c k ( r t c ) , a s s h o w n i n f i g u r e 8 8 . t h e e x t e r n a l 3 2 . 7 6 8 k h z c r y s t a l i s u s e d a s t h e c l o c k s o u r c e f o r t h e r t c . c a l i b r a t i o n i s p r o v i d e d t o c o m p e n s a t e t h e n o m i n a l c r y s t a l f r e q u e n c y a n d f o r v a r i a t i o n s i n t h e e x t e r n a l c r y s t a l f r e q u e n c y o v e r t e m p e r a t u r e . b y d e f a u l t , t h e r t c i s m a i n t a i n e d a c t i v e i n a l l p o w e r s a v i n g m o d e s . t h e r t c c o u n t e r s r e t a i n t h e i r v a l u e s t h r o u g h w a t c h d o g r e s e t s a n d e x t e r n a l r e s e t s . t h e y a r e o n l y r e s e t d u r i n g a p o w e r - o n r e s e t . 8 - b i t p r e s c a l e r s e c o n d s c o u n t e r s e c m i n u t e s c o u n t e r m i n h o u r s c o u n t e r h o u r i t e n a l a r m e v e n t 8 - b i t i n t e r v a l c o u n t e r i n t v a l s f r i n t e r v a l t i m e b a s e s e l e c t i o n m u x r t c e n 3 2 . 7 6 8 k h z c r y s t a l i t s 1 i t s 0 e q u a l ? c a l i b r a t i o n r t c c o m p t e m p c a l m i d n i g h t e v e n t c a l i b r a t e d 3 2 . 7 6 8 k h z h u n d r e d t h s c o u n t e r h t h s e c 0 7 3 2 7 - 0 8 8 f i g u r e 8 8 . r t c i m p l e m e n t a t i o n r t c r e g i s t e r s n o t e t h a t a l l t h e r e a l - t i m e c l o c k s f r s a r e n o t b i t a d d r e s s a b l e . t a b l e 1 0 8 . r e a l - t i m e c l o c k s f r s f r a d d r e s s d e s c r i p t i o n t i m e c o n 0 x a 1 r t c c o n f i g u r a t i o n ( s e e t a b l e 1 0 9 ) . h t h s e c 0 x a 2 h u n d r e d t h s o f a s e c o n d c o u n t e r ( s e e t a b l e 1 1 0 ) . s e c 0 x a 3 s e c o n d s c o u n t e r ( s e e t a b l e 1 1 1 ) . m i n 0 x a 4 m i n u t e s c o u n t e r ( s e e t a b l e 1 1 2 ) . h o u r 0 x a 5 h o u r s c o u n t e r ( s e e t a b l e 1 1 3 ) . i n t v a l 0 x a 6 a l a r m i n t e r v a l ( s e e t a b l e 1 1 4 ) . r t c c o m p 0 x f 6 r t c n o m i n a l c o m p e n s a t i o n ( s e e t a b l e 1 1 5 ) . t e m p c a l 0 x f 7 r t c t e m p e r a t u r e c o m p e n s a t i o n ( s e e t a b l e 1 1 6 ) . p r o t e c t i n g t h e r t c f r o m r u n a w a y c o d e t o p r o t e c t t h e r t c f r o m r u n a w a y c o d e , a k e y m u s t b e w r i t t e n t o t h e k y r e g r e g i s t e r t o o b t a i n w r i t e a c c e s s t o t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) , h u n d r e d t h s o f a s e c o n d c o u n t e r s f r ( h t h s e c , 0 x a 2 ) , s e c o n d s c o u n t e r s f r ( s e c , 0 x a 3 ) , m i n u t e s c o u n t e r s f r ( m i n , 0 x a 4 ) , a n d h o u r s c o u n t e r s f r ( h o u r , 0 x a 5 ) . k y r e g s h o u l d b e s e t t o 0 x e a t o u n l o c k i t a n d r e s e t i t t o z e r o a f t e r a t i m e k e e p i n g r e g i s t e r i s w r i t t e n t o . t h e r t c r e g i s t e r s c a n b e w r i t t e n u s i n g t h e f o l l o w i n g 8 0 5 2 a s s e m b l y c o d e : m o v k y r e g , # 0 e a h m o v i n t p r , # 0 8 0 h
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 1 o f 1 2 8 t a b l e 1 0 9 . r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 m i d n i g h t 0 m i d n i g h t f l a g . t h i s b i t i s s e t w h e n t h e r t c r o l l s o v e r t o 0 0 : 0 0 : 0 0 : 0 0 . i t c a n b e c l e a r e d b y t h e u s e r t o i n d i c a t e t h a t t h e m i d n i g h t e v e n t h a s b e e n s e r v i c e d . i n 2 4 - h o u r m o d e , t h e m i d n i g h t f l a g i s r a i s e d o n c e a d a y a t m i d n i g h t . w h e n t h i s i n t e r r u p t i s u s e d f o r w a k e - u p f r o m p s m 2 t o p s m 1 , t h e r t c i n t e r r u p t m u s t b e s e r v i c e d a n d t h e f l a g c l e a r e d t o b e a l l o w e d t o e n t e r p s m 2 . 6 t f h 0 2 4 - h o u r m o d e . t h i s b i t i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o w e r - o n r e s e t ( p o r ) . t f h r e s u l t 0 2 5 6 - h o u r m o d e . t h e h o u r r e g i s t e r r o l l s o v e r f r o m 2 5 5 t o 0 . 1 2 4 - h o u r m o d e . t h e h o u r r e g i s t e r r o l l s o v e r f r o m 2 3 t o 0 . 5 t o 4 i t s [ 1 : 0 ] 0 0 i n t e r v a l t i m e r t i m e b a s e s e l e c t i o n . i t s [ 1 : 0 ] r e s u l t ( t i m e b a s e ) 0 0 1 / 1 2 8 s e c . 0 1 s e c o n d . 1 0 m i n u t e . 1 1 h o u r . 3 s i t 0 i n t e r v a l t i m e r 1 a l a r m . s i t r e s u l t 0 t h e a l a r m f l a g i s s e t a f t e r i n t v a l c o u n t s a n d t h e n a n o t h e r i n t e r v a l c o u n t s t a r t s . 1 t h e a l a r m f l a g i s s e t a f t e r o n e t i m e i n t e r v a l . 2 a l a r m 0 i n t e r v a l t i m e r a l a r m f l a g . t h i s b i t i s s e t w h e n t h e c o n f i g u r e d t i m e i n t e r v a l h a s e l a p s e d . i t c a n b e c l e a r e d b y t h e u s e r t o i n d i c a t e t h a t t h e a l a r m e v e n t h a s b e e n s e r v i c e d . t h i s b i t c a n n o t b e s e t t o 1 b y u s e r c o d e . 1 i t e n 0 i n t e r v a l t i m e r e n a b l e . i t e n r e s u l t 0 t h e i n t e r v a l t i m e r i s d i s a b l e d . t h e 8 - b i t i n t e r v a l t i m e r c o u n t e r i s r e s e t . 1 s e t t h i s b i t t o e n a b l e t h e i n t e r v a l t i m e r . 0 r e s e r v e d 1 t h i s b i t m u s t b e l e f t s e t f o r p r o p e r o p e r a t i o n . t a b l e 1 1 0 . h u n d r e d t h s o f a s e c o n d c o u n t e r s f r ( h t h s e c , 0 x a 2 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 h t h s e c 0 t h i s c o u n t e r u p d a t e s e v e r y 1 / 1 2 8 s e c o n d , r e f e r e n c e d f r o m t h e c a l i b r a t e d 3 2 . 7 6 8 k h z c l o c k . i t o v e r f l o w s f r o m 1 2 7 t o 0 0 , i n c r e m e n t i n g t h e s e c o n d s c o u n t e r ( s e c ) . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r . t a b l e 1 1 1 . s e c o n d s c o u n t e r s f r ( s e c , 0 x a 3 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s e c 0 t h i s c o u n t e r u p d a t e s e v e r y s e c o n d , r e f e r e n c e d f r o m t h e c a l i b r a t e d 3 2 . 7 6 8 k h z c l o c k . i t o v e r f l o w s f r o m 5 9 t o 0 0 , i n c r e m e n t i n g t h e m i n u t e s c o u n t e r ( m i n ) . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r . t a b l e 1 1 2 . m i n u t e s c o u n t e r s f r ( m i n , 0 x a 4 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 m i n 0 t h i s c o u n t e r u p d a t e s e v e r y m i n u t e , r e f e r e n c e d f r o m t h e c a l i b r a t e d 3 2 . 7 6 8 k h z c l o c k . i t o v e r f l o w s f r o m 5 9 t o 0 0 , i n c r e m e n t i n g t h e h o u r s c o u n t e r ( h o u r ) . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r . t a b l e 1 1 3 . h o u r s c o u n t e r s f r ( h o u r , 0 x a 5 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 h o u r 0 t h i s c o u n t e r u p d a t e s e v e r y h o u r , r e f e r e n c e d f r o m t h e c a l i b r a t e d 3 2 . 7 6 8 k h z c l o c k . i f t h e t f h b i t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) i s s e t , t h e h o u r s f r o v e r f l o w s f r o m 2 3 t o 0 0 , s e t t i n g t h e m i d n i g h t b i t a n d c r e a t i n g a p e n d i n g r t c i n t e r r u p t . i f t h e t f h b i t i s c l e a r e d , t h e h o u r s f r o v e r f l o w s f r o m 2 5 5 t o 0 0 , s e t t i n g t h e m i d n i g h t b i t a n d c r e a t i n g a p e n d i n g r t c i n t e r r u p t . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 2 o f 1 2 8 t a b l e 1 1 4 . a l a r m i n t e r v a l s f r ( i n t v a l , 0 x a 6 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 i n t v a l 0 t h e i n t e r v a l t i m e r c o u n t s a c c o r d i n g t o t h e t i m e b a s e e s t a b l i s h e d i n t h e i t s [ 1 : 0 ] b i t s o f t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) . o n c e t h e n u m b e r o f c o u n t s i s e q u a l t o i n t v a l , t h e a l a r m f l a g i s s e t a n d a p e n d i n g r t c i n t e r r u p t i s c r e a t e d . n o t e t h a t t h e i n t e r v a l c o u n t e r i s e i g h t b i t s . t h e r e f o r e , i t c a n c o u n t u p t o 2 5 5 s e c o n d s , f o r e x a m p l e . t a b l e 1 1 5 . r t c n o m i n a l c o m p e n s a t i o n s f r ( r t c c o m p , 0 x f 6 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 r t c c o m p 0 t h e r t c c o m p s f r h o l d s t h e n o m i n a l r t c c o m p e n s a t i o n v a l u e a t 2 5 c . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r . t a b l e 1 1 6 . r t c t e m p e r a t u r e c o m p e n s a t i o n s f r ( t e m p c a l , 0 x f 7 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 t e m p c a l 0 t h e t e m p c a l s f r i s a d j u s t e d b a s e d o n a t e m p e r a t u r e r e a d . t h i s a l l o w s t h e e x t e r n a l c r y s t a l s h i f t t o b e c o m p e n s a t e d o v e r t e m p e r a t u r e . t h i s r e g i s t e r i s r e t a i n e d d u r i n g a w a t c h d o g r e s e t o r a n e x t e r n a l r e s e t . i t i s r e s e t a f t e r a p o r . t a b l e 1 1 7 . i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 r t c c a l 0 c o n t r o l s t h e r t c c a l i b r a t i o n o u t p u t . w h e n s e t , t h e r t c c a l i b r a t i o n f r e q u e n c y s e l e c t e d b y f s e l [ 1 : 0 ] i s o u t p u t o n t h e p 0 . 2 / c f 1 / r t c c a l p i n . 6 t o 5 f s e l [ 1 : 0 ] 0 0 s e t s r t c c a l i b r a t i o n o u t p u t f r e q u e n c y a n d c a l i b r a t i o n w i n d o w . f s e l [ 1 : 0 ] r e s u l t ( c a l i b r a t i o n w i n d o w , f r e q u e n c y ) 0 0 3 0 . 5 s e c , 1 h z 0 1 3 0 . 5 s e c , 5 1 2 h z 1 0 0 . 2 4 4 s e c , 5 0 0 h z 1 1 0 . 2 4 4 s e c , 1 6 . 3 8 4 k h z 4 r e s e r v e d 0 t h i s b i t m u s t b e s e t t o 0 f o r p r o p e r o p e r a t i o n . 3 t o 1 i n t 1 p r g [ 2 : 0 ] 0 0 0 c o n t r o l s t h e f u n c t i o n o f i n t 1 . i n t 1 p r g [ 2 : 0 ] r e s u l t x 0 0 g p i o x 0 1 b c t r l 0 1 x i n t 1 i n p u t d i s a b l e d 1 1 x i n t 1 i n p u t e n a b l e d 0 i n t 0 p r g 0 c o n t r o l s t h e f u n c t i o n o f i n t 0 . i n t 0 p r g r e s u l t 0 i n t 0 i n p u t d i s a b l e d 1 i n t 0 i n p u t e n a b l e d t a b l e 1 1 8 . k e y s f r ( k y r e g , 0 x c 1 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 k y r e g 0 w r i t e 0 x a 7 t o t h i s s f r b e f o r e w r i t i n g t o t h e p o w c o n s f r , w h i c h u n l o c k s k y r e g . w r i t e 0 x e a t o t h i s s f r b e f o r e w r i t i n g t o t h e i n t p r , h t h s e c , s e c , m i n , o r h o u r t i m e k e e p i n g r e g i s t e r s t o u n l o c k k y r e g .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 3 o f 1 2 8 r e a d a n d w r i t e o p e r a t i o n s w r i t i n g t o t h e r t c r e g i s t e r s t h e r t c c i r c u i t r y r u n s o f f a 3 2 . 7 6 8 k h z c l o c k . t h e t i m e k e e p i n g r e g i s t e r s , h u n d r e d t h s o f a s e c o n d c o u n t e r s f r ( h t h s e c , 0 x a 2 ) , s e c o n d s c o u n t e r s f r ( s e c , 0 x a 3 ) , m i n u t e s c o u n t e r s f r ( m i n , 0 x a 4 ) , a n d h o u r s c o u n t e r s f r ( h o u r , 0 x a 5 ) , a r e u p d a t e d w i t h a 3 2 . 7 6 8 k h z c l o c k . h o w e v e r , t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) a n d a l a r m i n t e r v a l s f r ( i n t v a l , 0 x a 6 ) a r e u p d a t e d w i t h a 1 2 8 h z c l o c k . i t t a k e s u p t o t w o 1 2 8 h z c l o c k c y c l e s f r o m w h e n t h e m c u w r i t e s t o t h e t i m e c o n s f r o r t h e i n t v a l s f r u n t i l t h e r e i s a s u c c e s s f u l u p d a t e i n t h e r t c . t o p r o t e c t t h e r t c t i m e k e e p i n g r e g i s t e r s f r o m r u n a w a y c o d e , a k e y m u s t b e w r i t t e n t o t h e k e y s f r ( k y r e g , 0 x c 1 ) , w h i c h i s d e s c r i b e d i n t a b l e 1 0 5 , t o o b t a i n w r i t e a c c e s s t o t h e h t h s e c , s e c , m i n , a n d h o u r s f r s . k y r e g s h o u l d b e s e t t o 0 x e a t o u n l o c k t h e t i m e k e e p i n g r e g i s t e r s a n d r e s e t t o 0 a f t e r a t i m e k e e p i n g r e g i s t e r i s w r i t t e n t o . t h e r t c r e g i s t e r s c a n b e w r i t t e n t o u s i n g t h e f o l l o w i n g 8 0 5 2 a s s e m b l y c o d e : m o v r t c k e y , # 0 e a h c a l l u p d a t e r t c ?u p d a t e r t c : m o v k y r e g , r t c k e y m o v s e c , # 3 0 m o v k y r e g , r t c k e y m o v m i n , # 0 5 m o v k y r e g , r t c k e y m o v h o u r , # 0 4 m o v k y r e g , # 0 0 h r e t r e a d i n g t h e r t c c o u n t e r s f r s t h e r t c c a n n o t b e s t o p p e d t o r e a d t h e c u r r e n t t i m e b e c a u s e s t o p p i n g t h e r t c i n t r o d u c e s a n e r r o r i n i t s t i m e k e e p i n g . t h e r e f o r e , t h e r t c i s r e a d o n t h e f l y , a n d t h e c o u n t e r r e g i s t e r s m u s t b e c h e c k e d f o r o v e r f l o w . t h i s c a n b e a c c o m p l i s h e d t h r o u g h t h e f o l l o w i n g 8 0 5 2 a s s e m b l y c o d e : r e a d a g a i n : m o v r 0 , h t h s e c ; u s i n g b a n k 0 m o v r 1 , s e c m o v r 2 , m i n m o v r 3 , h o u r m o v a , h t h s e c c j n e a , 0 0 h , r e a d a g a i n ; 0 0 h i s r 0 i n b a n k 0 r t c m o d e s t h e r t c c a n b e c o n f i g u r e d i n a 2 4 - h o u r m o d e o r a 2 5 6 - h o u r m o d e . a m i d n i g h t e v e n t i s g e n e r a t e d w h e n t h e r t c h o u r c o u n t e r r o l l s o v e r f r o m 2 3 t o 0 o r 2 5 5 t o 0 , d e p e n d i n g o n w h e t h e r t h e t f h b i t i s s e t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) . t h e m i d n i g h t e v e n t s e t s t h e m i d n i g h t f l a g i n t h e t i m e c o n s f r , a n d a p e n d i n g r t c i n t e r r u p t i s c r e a t e d . t h e r t c m i d n i g h t e v e n t w a k e s t h e 8 0 5 2 m c u c o r e i f t h e m c u i s a s l e e p i n p s m 2 w h e n t h e m i d n i g h t e v e n t o c c u r s . i n t h e 2 4 - h o u r m o d e , t h e m i d n i g h t e v e n t i s g e n e r a t e d o n c e a d a y a t m i d n i g h t . t h e 2 4 - h o u r m o d e i s u s e f u l f o r u p d a t i n g a s o f t w a r e c a l e n d a r t o k e e p t r a c k o f t h e c u r r e n t d a y . t h e 2 5 6 - h o u r m o d e r e s u l t s i n p o w e r s a v i n g s d u r i n g e x t e n d e d o p e r a t i o n i n p s m 2 b e c a u s e t h e m c u c o r e w a k e s u p l e s s f r e q u e n t l y . r t c i n t e r r u p t s t h e r t c m i d n i g h t i n t e r r u p t a n d a l a r m i n t e r r u p t a r e e n a b l e d b y s e t t i n g t h e e t i b i t i n t h e i n t e r r u p t e n a b l e a n d p r i o r i t y 2 s f r ( i e i p 2 , 0 x a 9 ) . w h e n a m i d n i g h t o r a l a r m e v e n t o c c u r s , a p e n d i n g r t c i n t e r r u p t i s g e n e r a t e d . i f t h e r t c i n t e r r u p t i s e n a b l e d , t h e p r o g r a m v e c t o r s t o t h e r t c i n t e r r u p t a d d r e s s a n d t h e p e n d i n g i n t e r r u p t i s c l e a r e d . i f t h e r t c i n t e r r u p t i s d i s a b l e d , t h e r t c i n t e r r u p t r e m a i n s p e n d i n g u n t i l t h e r t c i n t e r r u p t i s e n a b l e d . t h e p r o g r a m t h e n v e c t o r s t o t h e r t c i n t e r r u p t a d d r e s s . t h e m i d n i g h t f l a g a n d a l a r m f l a g a r e s e t w h e n t h e m i d - n i g h t e v e n t a n d a l a r m e v e n t o c c u r , r e s p e c t i v e l y . t h e u s e r s h o u l d m a n a g e t h e s e f l a g s t o k e e p t r a c k o f w h i c h e v e n t c a u s e d a n r t c i n t e r r u p t b y s e r v i c i n g t h e e v e n t a n d c l e a r i n g t h e a p p r o p r i a t e f l a g i n t h e r t c i n t e r r u p t s e r v i c i n g r o u t i n e . n o t e t h a t i f t h e a d e 7 5 1 8 i s a w a k e n e d b y a n r t c e v e n t , e i t h e r b y t h e m i d n i g h t e v e n t o r t h e a l a r m e v e n t , t h e p e n d i n g r t c i n t e r r u p t m u s t b e s e r v i c e d b e f o r e t h e d e v i c e c a n g o b a c k t o s l e e p a g a i n . t h e a d e 7 5 1 8 k e e p s w a k i n g u p u n t i l t h i s i n t e r - r u p t h a s b e e n s e r v i c e d . i n t e r v a l t i m e r a l a r m t h e r t c c a n b e u s e d a s a n i n t e r v a l t i m e r . w h e n t h e i n t e r v a l t i m e r i s e n a b l e d b y s e t t i n g t h e i t e n b i t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) , t h e i n t e r v a l t i m e r c l o c k s o u r c e s e l e c t e d b y t h e i t s 1 a n d i t s 0 b i t s i s p a s s e d t h r o u g h a n 8 - b i t c o u n t e r . t h i s c o u n t e r i n c r e m e n t s o n e v e r y i n t e r v a l t i m e r c l o c k p u l s e u n t i l i t i s e q u a l t o t h e v a l u e i n t h e a l a r m i n t e r v a l s f r ( i n t v a l , 0 x a 6 ) . t h e n , a n a l a r m e v e n t i s g e n e r a t e d , s e t t i n g t h e a l a r m f l a g a n d c r e a t i n g a p e n d i n g r t c i n t e r r u p t . i f t h e s i t b i t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) i s c l e a r e d , t h e 8 - b i t c o u n t e r i s a l s o c l e a r e d a n d s t a r t s c o u n t i n g a g a i n . i f t h e s i t b i t i s s e t , t h e 8 - b i t c o u n t e r i s h e l d i n r e s e t a f t e r t h e a l a r m o c c u r s .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 4 o f 1 2 8 t a k e c a r e w h e n c h a n g i n g t h e i n t e r v a l t i m e r t i m e b a s e . t h e r e c o m m e n d e d p r o c e d u r e i s a s f o l l o w s : 1 . i f t h e a l a r m i n t e r v a l s f r ( i n t v a l , 0 x a 6 ) i s g o i n g t o b e m o d i f i e d , w r i t e t o t h i s r e g i s t e r f i r s t . t h e n , w a i t f o r o n e 1 2 8 h z c l o c k c y c l e t o s y n c h r o n i z e w i t h t h e r t c , 6 4 , 0 0 0 c y c l e s a t a 4 . 0 9 6 m h z i n s t r u c t i o n c y c l e c l o c k . 2 . d i s a b l e t h e i n t e r v a l t i m e r b y c l e a r i n g t h e i t e n b i t i n t h e r t c c o n f i g u r a t i o n s f r ( t i m e c o n , 0 x a 1 ) . t h e n , w a i t f o r o n e 1 2 8 h z c l o c k c y c l e t o s y n c h r o n i z e w i t h t h e r t c , 6 4 , 0 0 0 c y c l e s a t a 4 . 0 9 6 m h z i n s t r u c t i o n c y c l e c l o c k . 3 . r e a d t h e t i m e c o n s f r t o e n s u r e t h a t t h e i t e n b i t i s c l e a r . i f i t i s n o t , w a i t f o r a n o t h e r 1 2 8 h z c l o c k c y c l e . 4 . s e t t h e t i m e b a s e b i t s ( i t s [ 1 : 0 ] ) i n t h e t i m e c o n s f r t o c o n f i g u r e t h e i n t e r v a l . w a i t f o r a 1 2 8 h z c l o c k c y c l e f o r t h i s c h a n g e t o t a k e e f f e c t . t h e r t c a l a r m e v e n t w a k e s t h e 8 0 5 2 m c u c o r e i f t h e m c u i s i n p s m 2 w h e n t h e a l a r m e v e n t o c c u r s . r t c c a l i b r a t i o n t h e r t c p r o v i d e s r e g i s t e r s t o c a l i b r a t e t h e n o m i n a l e x t e r n a l c r y s t a l f r e q u e n c y a n d i t s v a r i a t i o n o v e r t e m p e r a t u r e . a f r e q u e n c y e r r o r u p t o 2 4 8 p p m c a n b e c a l i b r a t e d b y t h e r t c c i r c u i t r y , w h i c h a d d s o r s u b t r a c t s p u l s e s f r o m t h e e x t e r n a l c r y s t a l s i g n a l . t h e n o m i n a l c r y s t a l f r e q u e n c y s h o u l d b e c a l i b r a t e d w i t h t h e r t c n o m i n a l c o m p e n s a t i o n r e g i s t e r s o t h a t t h e c l o c k g o i n g i n t o t h e r t c i s p r e c i s e l y 3 2 . 7 6 8 k h z a t 2 5 c . t h e r t c t e m p e r a t u r e c o m p e n s a t i o n s f r ( t e m p c a l , 0 x f 7 ) i s u s e d t o c o m p e n s a t e f o r t h e e x t e r n a l c r y s t a l d r i f t o v e r t e m p e r a t u r e b y a d d i n g o r s u b t r a c t i n g a d d i t i o n a l p u l s e s b a s e d o n t e m p e r a t u r e . t h e l s b o f e a c h r t c c o m p e n s a t i o n r e g i s t e r r e p r e s e n t s a 2 p p m f r e q u e n c y e r r o r . t h e r t c c o m p e n s a t i o n c i r c u i t r y a d d s t h e r t c t e m p e r a t u r e c o m p e n s a t i o n s f r ( t e m p c a l , 0 x f 7 ) a n d t h e r t c n o m i n a l c o m p e n s a t i o n s f r ( r t c c o m p , 0 x f 6 ) t o d e t e r m i n e h o w m u c h c o m p e n s a t i o n i s r e q u i r e d . n o t e t h a t t h e s u m o f t h e s e t w o r e g i s t e r s i s l i m i t e d t o 2 4 8 p p m . c a l i b r a t i o n f l o w a n r t c c a l i b r a t i o n p u l s e o u t p u t i s p r o v i d e d o n t h e p 0 . 2 / c f 1 / r t c c a l p i n . e n a b l e t h e r t c o u t p u t b y s e t t i n g t h e r t c c a l b i t i n t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) . t h e r t c c a l i b r a t i o n i s a c c u r a t e t o w i t h i n 2 p p m o v e r a 3 0 . 5 s e c w i n d o w i n a l l o p e r a t i o n a l m o d e s : p s m 0 , p s m 1 , a n d p s m 2 . t w o o u t p u t f r e q u e n c i e s a r e o f f e r e d f o r t h e n o r m a l r t c m o d e : 1 h z w i t h f s e l [ 1 : 0 ] = 0 0 a n d 5 1 2 h z w i t h f s e l [ 1 : 0 ] = 0 1 i n t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) . a s h o r t e r w i n d o w o f 0 . 2 4 4 s e c i s o f f e r e d f o r f a s t c a l i b r a t i o n d u r i n g p s m 0 o r p s m 1 . t w o o u t p u t f r e q u e n c i e s a r e o f f e r e d f o r t h i s r t c c a l i b r a t i o n o u t p u t m o d e : 5 0 0 h z w i t h f s e l [ 1 : 0 ] = 1 0 a n d 1 6 . 3 8 4 k h z w i t h f s e l [ 1 : 0 ] = 1 1 i n t h e i n t p r s f r . n o t e t h a t f o r t h e 0 . 2 4 4 s e c c a l i b r a t i o n w i n d o w , t h e r t c i s c l o c k e d 1 2 5 t i m e s f a s t e r t h a n i n n o r m a l m o d e , r e s u l t i n g i n t i m e k e e p i n g r e g i s t e r s t h a t r e p r e s e n t s e c o n d s / 1 2 5 , m i n u t e s / 1 2 5 , a n d h o u r s / 1 2 5 i n s t e a d o f s e c o n d s , m i n u t e s , a n d h o u r s . t h e r e f o r e , t h i s m o d e s h o u l d b e u s e d f o r c a l i b r a t i o n o n l y . t a b l e 1 1 9 . r t c c a l i b r a t i o n o p t i o n s o p t i o n f s e l [ 1 : 0 ] c a l i b r a t i o n w i n d o w ( s e c ) f r t c c a l ( h z ) n o r m a l m o d e 0 0 0 3 0 . 5 1 n o r m a l m o d e 1 0 1 3 0 . 5 5 1 2 c a l i b r a t i o n m o d e 0 1 0 0 . 2 4 4 5 0 0 c a l i b r a t i o n m o d e 1 1 1 0 . 2 4 4 1 6 , 3 8 4 w h e n n o r t c c o m p e n s a t i o n i s a p p l i e d , t h a t i s , w h e n r t c n o m i n a l c o m p e n s a t i o n s f r ( r t c c o m p , 0 x f 6 ) a n d r t c t e m p e r a t u r e c o m p e n s a t i o n s f r ( t e m p c a l , 0 x f 7 ) a r e e q u a l t o 0 , t h e n o m i n a l c o m p e n s a t i o n r e q u i r e d t o a c c o u n t f o r t h e e r r o r i n t h e e x t e r n a l c r y s t a l c a n b e d e t e r m i n e d . i n t h i s c a s e , i t i s n o t n e c e s s a r y t o w a i t f o r a n e n t i r e c a l i b r a t i o n w i n d o w t o d e t e r m i n e t h e e r r o r i n t h e p u l s e o u t p u t . c a l c u l a t i n g t h e e r r o r i n f r e q u e n c y b e t w e e n t w o c o n s e c u t i v e p u l s e s o n t h e p 0 . 2 / c f 1 / r t c c a l p i n i s s u f f i c i e n t . t h e v a l u e t o w r i t e t o t h e r t c n o m i n a l c o m p e n s a t i o n s f r ( r t c c o m p , 0 x f 6 ) i s c a l c u l a t e d f r o m t h e % e r r o r o r s e c o n d s p e r d a y e r r o r o n t h e f r e q u e n c y o u t p u t . e a c h l s b o f t h e r t c c o m p s f r r e p r e s e n t s 2 p p m o f c o r r e c t i o n w h e r e 1 s e c / d a y e r r o r i s e q u a l t o 1 1 . 5 7 p p m . ) ( % 5 0 0 0 e r r o r r t c c o m p u ) ( 5 7 . 1 1 2 1 e r r o r s e c / d a y r t c c o m p u u d u r i n g c a l i b r a t i o n , u s e r s o f t w a r e w r i t e s t h e r t c w i t h t h e c u r r e n t t i m e . r e f e r t o t h e r e a d a n d w r i t e o p e r a t i o n s s e c t i o n f o r m o r e i n f o r m a t i o n o n h o w t o r e a d a n d w r i t e t h e r t c t i m e k e e p i n g r e g i s t e r s .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 5 o f 1 2 8 u a r t s e r i a l i n t e r f a c e t h e a d e 7 5 1 8 u a r t c a n b e c o n f i g u r e d i n o n e o f f o u r m o d e s . x s h i f t r e g i s t e r w i t h b a u d r a t e f i x e d a t f c o r e / 1 2 x 8 - b i t u a r t w i t h v a r i a b l e b a u d r a t e x 9 - b i t u a r t w i t h b a u d r a t e f i x e d a t f c o r e / 6 4 o r f c o r e / 3 2 x 9 - b i t u a r t w i t h v a r i a b l e b a u d r a t e v a r i a b l e b a u d r a t e s a r e d e f i n e d b y u s i n g a n i n t e r n a l t i m e r t o g e n e r a t e a n y r a t e b e t w e e n 3 0 0 b a u d / s e c a n d 1 1 5 , 2 0 0 b a u d / s e c . t h e u a r t s e r i a l i n t e r f a c e p r o v i d e d i n t h e a d e 7 5 1 8 i s a f u l l - d u p l e x s e r i a l i n t e r f a c e . i t i s a l s o r e c e i v e - b u f f e r e d b y s t o r i n g t h e f i r s t r e c e i v e d b y t e i n a r e c e i v e b u f f e r u n t i l t h e r e c e p t i o n o f t h e s e c o n d b y t e i s c o m p l e t e . t h e p h y s i c a l i n t e r f a c e t o t h e u a r t i s p r o v i d e d v i a t h e r x d ( p 1 . 0 ) a n d t x d ( p 1 . 1 ) p i n s , w h e r e a s t h e f i r m w a r e i n t e r f a c e i s t h r o u g h t h e s f r s p r e s e n t e d i n t a b l e 1 2 0 . b o t h t h e s e r i a l p o r t r e c e i v e a n d t r a n s m i t r e g i s t e r s a r e a c c e s s e d t h r o u g h t h e s e r i a l p o r t b u f f e r s f r ( s b u f , 0 x 9 9 ) . w r i t i n g t o s b u f l o a d s t h e t r a n s m i t r e g i s t e r , a n d r e a d i n g s b u f a c c e s s e s a p h y s i c a l l y s e p a r a t e r e c e i v e r e g i s t e r . a n e n h a n c e d u a r t m o d e i s o f f e r e d b y u s i n g t h e u a r t t i m e r a n d b y p r o v i d i n g e n h a n c e d f r a m e e r r o r , b r e a k e r r o r , a n d o v e r w r i t e e r r o r d e t e c t i o n . t h i s m o d e i s e n a b l e d b y s e t t i n g t h e e x t e n b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) ( s e e t h e u a r t a d d i t i o n a l f e a t u r e s s e c t i o n ) . t h e e n h a n c e d s e r i a l b a u d r a t e c o n t r o l s f r ( s b a u d t , 0 x 9 e ) a n d u a r t t i m e r f r a c t i o n a l d i v i d e r s f r ( s b a u d f , 0 x 9 d ) a r e u s e d t o c o n f i g u r e t h e u a r t t i m e r a n d t o i n d i c a t e t h e e n h a n c e d u a r t e r r o r s . u a r t r e g i s t e r s t a b l e 1 2 0 . s e r i a l p o r t s f r s s f r a d d r e s s b i t a d d r e s s a b l e d e s c r i p t i o n s c o n 0 x 9 8 y e s s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r ( s e e t a b l e 1 2 1 ) . s b u f 0 x 9 9 n o s e r i a l p o r t b u f f e r ( s e e t a b l e 1 2 2 ) . s b a u d t 0 x 9 e n o e n h a n c e d s e r i a l b a u d r a t e c o n t r o l ( s e e t a b l e 1 2 3 ) . s b a u d f 0 x 9 d n o u a r t t i m e r f r a c t i o n a l d i v i d e r ( s e e t a b l e 1 2 4 ) . t a b l e 1 2 1 . s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r s f r ( s c o n , 0 x 9 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 0 x 9 f , 0 x 9 e s m 0 , s m 1 0 0 u a r t s e r i a l m o d e s e l e c t b i t s . t h e s e b i t s s e l e c t t h e s e r i a l p o r t o p e r a t i n g m o d e . s m [ 1 : 0 ] r e s u l t ( s e l e c t e d o p e r a t i n g m o d e ) 0 0 m o d e 0 , s h i f t r e g i s t e r , f i x e d b a u d r a t e a t f c o r e / 1 2 . 0 1 m o d e 1 , 8 - b i t u a r t , v a r i a b l e b a u d r a t e . 1 0 m o d e 2 , 9 - b i t u a r t , f i x e d b a u d r a t e a t f c o r e / 3 2 o r f c o r e / 1 6 . 1 1 m o d e 3 , 9 - b i t u a r t , v a r i a b l e b a u d r a t e . 5 0 x 9 d s m 2 0 m u l t i p r o c e s s o r c o m m u n i c a t i o n e n a b l e b i t . e n a b l e s m u l t i p r o c e s s o r c o m m u n i c a t i o n i n m o d e 2 a n d m o d e 3 , a n d f r a m i n g e r r o r d e t e c t i o n i n m o d e 1 . i n m o d e 0 , s m 2 s h o u l d b e c l e a r e d . i n m o d e 1 , i f s m 2 i s s e t , r i i s n o t a c t i v a t e d i f a v a l i d s t o p b i t w a s n o t r e c e i v e d . i f s m 2 i s c l e a r e d , r i i s s e t a s s o o n a s t h e b y t e o f d a t a i s r e c e i v e d . i n m o d e 2 o r m o d e 3 , i f s m 2 i s s e t , r i i s n o t a c t i v a t e d i f t h e r e c e i v e d n i n t h d a t a b i t i n r b 8 i s 0 . i f s m 2 i s c l e a r e d , r i i s s e t a s s o o n a s t h e b y t e o f d a t a i s r e c e i v e d . 4 0 x 9 c r e n 0 s e r i a l p o r t r e c e i v e e n a b l e b i t . s e t b y u s e r s o f t w a r e t o e n a b l e s e r i a l p o r t r e c e p t i o n . c l e a r e d b y u s e r s o f t w a r e t o d i s a b l e s e r i a l p o r t r e c e p t i o n . 3 0 x 9 b t b 8 0 s e r i a l p o r t t r a n s m i t b i t 9 . t h e d a t a l o a d e d i n t o t b 8 i s t h e n i n t h d a t a b i t t r a n s m i t t e d i n m o d e 2 a n d m o d e 3 . 2 0 x 9 a r b 8 0 s e r i a l p o r t r e c e i v e r b i t 9 . t h e n i n t h d a t a b i t r e c e i v e d i n m o d e 2 a n d m o d e 3 i s l a t c h e d i n t o r b 8 . f o r m o d e 1 , t h e s t o p b i t i s l a t c h e d i n t o r b 8 . 1 0 x 9 9 t i 0 s e r i a l p o r t t r a n s m i t i n t e r r u p t f l a g . s e t b y h a r d w a r e a t t h e e n d o f t h e e i g h t h b i t i n m o d e 0 o r a t t h e b e g i n n i n g o f t h e s t o p b i t i n m o d e 1 , m o d e 2 , a n d m o d e 3 . t i m u s t b e c l e a r e d b y u s e r s o f t w a r e . 0 0 x 9 8 r i 0 s e r i a l p o r t r e c e i v e i n t e r r u p t f l a g . s e t b y h a r d w a r e a t t h e e n d o f t h e e i g h t h b i t i n m o d e 0 o r h a l f w a y t h r o u g h t h e s t o p b i t i n m o d e 1 , m o d e 2 , a n d m o d e 3 . r i m u s t b e c l e a r e d b y u s e r s o f t w a r e .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 6 o f 1 2 8 t a b l e 1 2 2 . s e r i a l p o r t b u f f e r s f r ( s b u f , 0 x 9 9 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s b u f 0 s e r i a l p o r t d a t a b u f f e r . t a b l e 1 2 3 . e n h a n c e d s e r i a l b a u d r a t e c o n t r o l s f r ( s b a u d t , 0 x 9 e ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 o w e 0 o v e r w r i t e e r r o r . t h i s b i t i s s e t w h e n n e w d a t a i s r e c e i v e d a n d r i = 1 . i t i n d i c a t e s t h a t s b u f w a s n o t r e a d b e f o r e t h e n e x t c h a r a c t e r w a s t r a n s f e r r e d i n , c a u s i n g t h e p r i o r s b u f d a t a t o b e l o s t . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 6 f e 0 f r a m e e r r o r . t h i s b i t i s s e t w h e n t h e r e c e i v e d f r a m e d o e s n o t h a v e a v a l i d s t o p b i t . t h i s b i t i s r e a d o n l y a n d i s u p d a t e d e v e r y t i m e a f r a m e i s r e c e i v e d . 5 b e 0 b r e a k e r r o r . t h i s b i t i s s e t w h e n e v e r t h e r e c e i v e d a t a l i n e ( r x ) i s l o w f o r l o n g e r t h a n a f u l l t r a n s m i s s i o n f r a m e , w h i c h i s t h e t i m e r e q u i r e d f o r a s t a r t b i t , e i g h t d a t a b i t s , a p a r i t y b i t , a n d h a l f a s t o p b i t . t h i s b i t i s u p d a t e d e v e r y t i m e a f r a m e i s r e c e i v e d . 4 , 3 s b t h [ 1 : 0 ] 0 e x t e n d e d d i v i d e r r a t i o f o r b a u d r a t e s e t t i n g , a s s h o w n i n t a b l e 1 2 5 . 2 t o 0 d i v [ 2 : 0 ] 0 0 0 b i n a r y d i v i d e r . s e e t a b l e 1 2 5 . d i v [ 2 : 0 ] r e s u l t 0 0 0 d i v i d e b y 1 . 0 0 1 d i v i d e b y 2 . 0 1 0 d i v i d e b y 4 . 0 1 1 d i v i d e b y 8 . 1 0 0 d i v i d e b y 1 6 . 1 0 1 d i v i d e b y 3 2 . 1 1 0 d i v i d e b y 6 4 . 1 1 1 d i v i d e b y 1 2 8 . t a b l e 1 2 4 . u a r t t i m e r f r a c t i o n a l d i v i d e r s f r ( s b a u d f , 0 x 9 d ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 u a r t b a u d e n 0 u a r t b a u d r a t e e n a b l e . s e t t o e n a b l e u a r t t i m e r t o g e n e r a t e t h e b a u d r a t e . w h e n t h i s b i t i s s e t , p c o n [ 7 ] ( s m o d ) , t 2 c o n [ 4 ] ( t c l k ) , a n d t 2 c o n [ 5 ] ( r c l k ) a r e i g n o r e d . c l e a r e d t o l e t t h e b a u d r a t e b e g e n e r a t e d a s p e r a s t a n d a r d 8 0 5 2 . 6 n o t i m p l e m e n t e d , w r i t e d o n ? t c a r e . 5 s b a u d f . 5 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 5 . 4 s b a u d f . 4 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 4 . 3 s b a u d f . 3 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 3 . 2 s b a u d f . 2 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 2 . 1 s b a u d f . 1 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 1 . 0 s b a u d f . 0 0 u a r t t i m e r f r a c t i o n a l d i v i d e r b i t 0 .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 7 o f 1 2 8 t a b l e 1 2 5 . c o m m o n b a u d r a t e s u s i n g u a r t t i m e r w i t h a 4 . 0 9 6 m h z p l l c l o c k i d e a l b a u d c d s b t h d i v s b a u d t s b a u d f % e r r o r 1 1 5 , 2 0 0 0 0 1 0 x 0 1 0 x 8 7 + 0 . 1 6 1 1 5 , 2 0 0 1 0 0 0 x 0 0 0 x 8 7 + 0 . 1 6 5 7 , 6 0 0 0 0 2 0 x 0 2 0 x 8 7 + 0 . 1 6 5 7 , 6 0 0 1 0 1 0 x 0 1 0 x 8 7 + 0 . 1 6 3 8 , 4 0 0 0 0 2 0 x 0 2 0 x a b ? 0 . 3 1 3 8 , 4 0 0 1 0 1 0 x 0 1 0 x a b ? 0 . 3 1 3 8 , 4 0 0 2 0 0 0 x 0 0 0 x a b ? 0 . 3 1 1 9 , 2 0 0 0 0 3 0 x 0 3 0 x a b ? 0 . 3 1 1 9 , 2 0 0 1 0 2 0 x 0 2 0 x a b ? 0 . 3 1 1 9 , 2 0 0 2 0 1 0 x 0 1 0 x a b ? 0 . 3 1 1 9 , 2 0 0 3 0 0 0 x 0 0 0 x a b ? 0 . 3 1 9 6 0 0 0 0 4 0 x 0 4 0 x a b ? 0 . 3 1 9 6 0 0 1 0 3 0 x 0 3 0 x a b ? 0 . 3 1 9 6 0 0 2 0 2 0 x 0 2 0 x a b ? 0 . 3 1 9 6 0 0 3 0 1 0 x 0 1 0 x a b ? 0 . 3 1 9 6 0 0 4 0 0 0 x 0 0 0 x a b ? 0 . 3 1 4 8 0 0 0 0 5 0 x 0 5 0 x a b ? 0 . 3 1 4 8 0 0 1 0 4 0 x 0 4 0 x a b ? 0 . 3 1 4 8 0 0 2 0 3 0 x 0 3 0 x a b ? 0 . 3 1 4 8 0 0 3 0 2 0 x 0 2 0 x a b ? 0 . 3 1 4 8 0 0 4 0 1 0 x 0 1 0 x a b ? 0 . 3 1 4 8 0 0 5 0 0 0 x 0 0 0 x a b ? 0 . 3 1 2 4 0 0 0 0 6 0 x 0 6 0 x a b ? 0 . 3 1 2 4 0 0 1 0 5 0 x 0 5 0 x a b ? 0 . 3 1 2 4 0 0 2 0 4 0 x 0 4 0 x a b ? 0 . 3 1 2 4 0 0 3 0 3 0 x 0 3 0 x a b ? 0 . 3 1 2 4 0 0 4 0 2 0 x 0 2 0 x a b ? 0 . 3 1 2 4 0 0 5 0 1 0 x 0 1 0 x a b ? 0 . 3 1 2 4 0 0 6 0 0 0 x 0 0 0 x a b ? 0 . 3 1 3 0 0 0 2 7 0 x 1 7 0 x a b ? 0 . 3 1 3 0 0 1 1 7 0 x 0 f 0 x a b ? 0 . 3 1 3 0 0 2 0 7 0 x 0 7 0 x a b ? 0 . 3 1 3 0 0 3 0 6 0 x 0 6 0 x a b ? 0 . 3 1 3 0 0 4 0 5 0 x 0 5 0 x a b ? 0 . 3 1 3 0 0 5 0 4 0 x 0 4 0 x a b ? 0 . 3 1 3 0 0 6 0 3 0 x 0 3 0 x a b ? 0 . 3 1 3 0 0 7 0 2 0 x 0 2 0 x a b ? 0 . 3 1
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 8 o f 1 2 8 u a r t o p e r a t i o n m o d e s m o d e 0 ( s h i f t r e g i s t e r w i t h b a u d r a t e f i x e d a t f c o r e / 1 2 ) m o d e 0 i s s e l e c t e d w h e n t h e s m 0 a n d s m 1 b i t s i n t h e s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r b i t d e s c r i p t i o n s f r ( s c o n , 0 x 9 8 ) a r e c l e a r e d . i n t h i s s h i f t r e g i s t e r m o d e , s e r i a l d a t a e n t e r s a n d e x i t s t h r o u g h r x d . t x d o u t p u t s t h e s h i f t c l o c k . t h e b a u d r a t e i s f i x e d a t f c o r e / 1 2 . e i g h t d a t a b i t s a r e t r a n s m i t t e d o r r e c e i v e d . t r a n s m i s s i o n i s i n i t i a t e d b y a n y i n s t r u c t i o n t h a t w r i t e s t o t h e s e r i a l p o r t b u f f e r s f r ( s b u f , 0 x 9 9 ) . t h e d a t a i s s h i f t e d o u t o f t h e r x d l i n e . t h e e i g h t b i t s a r e t r a n s m i t t e d w i t h t h e l e a s t s i g n i f i c a n t b i t ( l s b ) f i r s t . r e c e p t i o n i s i n i t i a t e d w h e n t h e r e c e i v e e n a b l e b i t ( r e n ) i s 1 a n d t h e r e c e i v e i n t e r r u p t b i t ( r i ) i s 0 . w h e n r i i s c l e a r e d , t h e d a t a i s c l o c k e d i n t o t h e r x d l i n e , a n d t h e c l o c k p u l s e s a r e o u t p u t f r o m t h e t x d l i n e , a s s h o w n i n f i g u r e 8 9 . r x d ( d a t a o u t ) t x d ( s h i f t c l o c k ) d a t a b i t 0 d a t a b i t 1 d a t a b i t 6 d a t a b i t 7 0 7 3 2 7 - 0 8 9 f i g u r e 8 9 . 8 - b i t s h i f t r e g i s t e r m o d e m o d e 1 ( 8 - b i t u a r t , v a r i a b l e b a u d r a t e ) m o d e 1 i s s e l e c t e d b y c l e a r i n g s m 0 a n d s e t t i n g s m 1 . e a c h d a t a b y t e ( l s b f i r s t ) i s p r e c e d e d b y a s t a r t b i t ( 0 ) a n d f o l l o w e d b y a s t o p b i t ( 1 ) . t h e r e f o r e , e a c h f r a m e c o n s i s t s o f 1 0 b i t s t r a n s m i t t e d o n t x d o r r e c e i v e d o n r x d . t h e b a u d r a t e i s s e t b y a t i m e r o v e r f l o w r a t e . t i m e r 1 o r t i m e r 2 c a n b e u s e d t o g e n e r a t e b a u d r a t e s , o r b o t h t i m e r s c a n b e u s e d s i m u l t a n e o u s l y w h e r e o n e g e n e r a t e s t h e t r a n s m i t r a t e a n d t h e o t h e r g e n e r a t e s t h e r e c e i v e r a t e . t h e r e i s a l s o a d e d i c a t e d t i m e r f o r b a u d r a t e g e n e r a t i o n , t h e u a r t t i m e r , w h i c h h a s a f r a c t i o n a l d i v i s o r t o p r e c i s e l y g e n e r a t e a n y b a u d r a t e ( s e e t h e u a r t t i m e r g e n e r a t e d b a u d r a t e s s e c t i o n ) . t r a n s m i s s i o n i s i n i t i a t e d b y a w r i t e t o t h e s e r i a l p o r t b u f f e r s f r ( s b u f , 0 x 9 9 ) . n e x t , a s t o p b i t ( 1 ) i s l o a d e d i n t o t h e n i n t h b i t p o s i t i o n o f t h e t r a n s m i t s h i f t r e g i s t e r . t h e d a t a i s o u t p u t b i t b y b i t u n t i l t h e s t o p b i t a p p e a r s o n t x d a n d t h e t r a n s m i t i n t e r r u p t f l a g ( t i ) i s a u t o m a t i c a l l y s e t a s s h o w n i n f i g u r e 9 0 . t x d t i ( s c o n . 1 ) s t a r t b i t d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 s t o p b i t s e t i n t e r r u p t ( f o r e x a m p l e , r e a d y f o r m o r e d a t a ) 0 7 3 2 7 - 0 9 0 f i g u r e 9 0 . 8 - b i t v a r i a b l e b a u d r a t e r e c e p t i o n i s i n i t i a t e d w h e n a 1 - t o - 0 t r a n s i t i o n i s d e t e c t e d o n r x d . a s s u m i n g t h a t a v a l i d s t a r t b i t i s d e t e c t e d , c h a r a c t e r r e c e p t i o n c o n t i n u e s . t h e e i g h t d a t a b i t s a r e c l o c k e d i n t o t h e s e r i a l p o r t s h i f t r e g i s t e r . a l l o f t h e f o l l o w i n g c o n d i t i o n s m u s t b e m e t a t t h e t i m e t h e f i n a l s h i f t p u l s e i s g e n e r a t e d t o r e c e i v e a c h a r a c t e r : x i f t h e e x t e n d e d u a r t i s d i s a b l e d ( e x t e n = 0 i n t h e c f g s f r ) , r i m u s t b e 0 t o r e c e i v e a c h a r a c t e r . t h i s e n s u r e s t h a t t h e d a t a i n t h e s b u f s f r i s n o t o v e r w r i t t e n i f t h e l a s t r e c e i v e d c h a r a c t e r h a s n o t b e e n r e a d . x i f f r a m e e r r o r c h e c k i n g i s e n a b l e d b y s e t t i n g s m 2 , t h e r e c e i v e d s t o p b i t m u s t b e s e t t o r e c e i v e a c h a r a c t e r . t h i s e n s u r e s t h a t e v e r y c h a r a c t e r r e c e i v e d c o m e s f r o m a v a l i d f r a m e , w i t h b o t h a s t a r t b i t a n d a s t o p b i t . i f a n y o f t h e s e c o n d i t i o n s a r e n o t m e t , t h e r e c e i v e d f r a m e i s i r r e t r i e v a b l y l o s t , a n d t h e r e c e i v e i n t e r r u p t f l a g ( r i ) i s n o t s e t . i f t h e r e c e i v e d f r a m e h a s m e t t h e p r e v i o u s c r i t e r i a , t h e f o l l o w i n g e v e n t s o c c u r : x t h e e i g h t b i t s i n t h e r e c e i v e s h i f t r e g i s t e r a r e l a t c h e d i n t o t h e s b u f s f r . x t h e n i n t h b i t ( s t o p b i t ) i s c l o c k e d i n t o r b 8 i n t h e s c o n s f r . x t h e r e c e i v e r i n t e r r u p t f l a g ( r i ) i s s e t . m o d e 2 ( 9 - b i t u a r t w i t h b a u d f i x e d a t f c o r e / 6 4 o r f c o r e / 3 2 ) m o d e 2 i s s e l e c t e d b y s e t t i n g s m 0 a n d c l e a r i n g s m 1 . i n t h i s m o d e , t h e u a r t o p e r a t e s i n 9 - b i t m o d e w i t h a f i x e d b a u d r a t e . t h e b a u d r a t e i s f i x e d a t f c o r e / 6 4 b y d e f a u l t , a l t h o u g h s e t t i n g t h e s m o d b i t i n t h e p r o g r a m c o n t r o l s f r ( p c o n , 0 x 8 7 ) d o u b l e s t h e f r e q u e n c y t o f c o r e / 3 2 . e l e v e n b i t s a r e t r a n s m i t t e d o r r e c e i v e d : a s t a r t b i t ( 0 ) , e i g h t d a t a b i t s , a p r o g r a m m a b l e n i n t h b i t , a n d a s t o p b i t ( 1 ) . t h e n i n t h b i t i s m o s t o f t e n u s e d a s a p a r i t y b i t o r a s p a r t o f a m u l t i p r o c e s s o r c o m m u n i c a t i o n p r o t o c o l , a l t h o u g h i t c a n b e u s e d f o r a n y t h i n g , i n c l u d i n g a n i n t h d a t a b i t , i f r e q u i r e d . t o u s e t h e n i n t h d a t a b i t a s p a r t o f a c o m m u n i c a t i o n p r o t o c o l f o r a m u l t i p r o c e s s o r n e t w o r k s u c h a s r s - 4 8 5 , t h e n i n t h b i t i s s e t t o i n d i c a t e t h a t t h e f r a m e c o n t a i n s t h e a d d r e s s o f t h e d e v i c e w i t h w h i c h t h e m a s t e r w a n t s t o c o m m u n i c a t e . t h e d e v i c e s o n t h e n e t w o r k a r e a l w a y s l i s t e n i n g f o r a p a c k e t w i t h t h e n i n t h b i t s e t a n d a r e c o n f i g u r e d s u c h t h a t i f t h e n i n t h b i t i s c l e a r e d , t h e f r a m e i s n o t v a l i d , a n d a r e c e i v e i n t e r r u p t i s n o t g e n e r a t e d . i f t h e n i n t h b i t i s s e t , a l l d e v i c e s o n t h e n e t w o r k r e c e i v e t h e a d d r e s s a n d o b t a i n a r e c e i v e c h a r a c t e r i n t e r r u p t . t h e d e v i c e s e x a m i n e t h e a d d r e s s a n d , i f i t m a t c h e s o n e o f t h e d e v i c e ? s p r e p r o g r a m m e d a d d r e s s e s , t h a t d e v i c e c o n f i g u r e s i t s e l f t o l i s t e n t o a l l i n c o m i n g f r a m e s , e v e n t h o s e w i t h t h e n i n t h b i t c l e a r e d . b e c a u s e t h e m a s t e r h a s i n i t i a t e d c o m m u n i c a t i o n w i t h t h a t d e v i c e , a l l t h e f o l l o w i n g p a c k e t s w i t h t h e n i n t h b i t c l e a r e d a r e i n t e n d e d s p e c i f i c a l l y f o r t h a t a d d r e s s e d d e v i c e u n t i l a n o t h e r p a c k e t w i t h t h e n i n t h b i t s e t i s r e c e i v e d . i f t h e a d d r e s s d o e s n o t m a t c h , t h e d e v i c e c o n t i n u e s t o l i s t e n f o r a d d r e s s p a c k e t s .
a d e 7 5 1 8 r e v . 0 | p a g e 1 0 9 o f 1 2 8 t o t r a n s m i t , t h e e i g h t d a t a b i t s m u s t b e w r i t t e n i n t o t h e s e r i a l p o r t b u f f e r s f r ( s b u f , 0 x 9 9 ) . t h e n i n t h b i t m u s t b e w r i t t e n t o t b 8 i n t h e s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r s f r ( s c o n , 0 x 9 8 ) . w h e n t r a n s m i s s i o n i s i n i t i a t e d , t h e e i g h t d a t a b i t s f r o m s b u f a r e l o a d e d i n t o t h e t r a n s m i t s h i f t r e g i s t e r ( l s b f i r s t ) . t h e n i n t h d a t a b i t , h e l d i n t b 8 , i s l o a d e d i n t o t h e n i n t h b i t p o s i t i o n o f t h e t r a n s m i t s h i f t r e g i s t e r . t h e t r a n s m i s s i o n s t a r t s a t t h e n e x t v a l i d b a u d r a t e c l o c k . t h e t r a n s m i t i n t e r r u p t f l a g ( t i ) i s s e t a s s o o n a s t h e t r a n s m i s s i o n c o m p l e t e s , w h e n t h e s t o p b i t a p p e a r s o n t x d . a l l o f t h e f o l l o w i n g c o n d i t i o n s m u s t b e m e t a t t h e t i m e t h e f i n a l s h i f t p u l s e i s g e n e r a t e d t o r e c e i v e a c h a r a c t e r : x i f t h e e x t e n d e d u a r t i s d i s a b l e d ( e x t e n = 0 i n t h e c f g s f r ) , r i m u s t b e 0 t o r e c e i v e a c h a r a c t e r . t h i s e n s u r e s t h a t t h e d a t a i n s b u f i s n o t o v e r w r i t t e n i f t h e l a s t r e c e i v e d c h a r a c t e r h a s n o t b e e n r e a d . x i f m u l t i p r o c e s s o r c o m m u n i c a t i o n i s e n a b l e d b y s e t t i n g s m 2 , t h e r e c e i v e d n i n t h b i t m u s t b e s e t t o r e c e i v e a c h a r a c t e r . t h i s e n s u r e s t h a t o n l y f r a m e s w i t h t h e n i n t h b i t s e t , t h a t i s , f r a m e s t h a t c o n t a i n a d d r e s s e s , g e n e r a t e a r e c e i v e i n t e r r u p t . i f a n y o f t h e s e c o n d i t i o n s a r e n o t m e t , t h e r e c e i v e d f r a m e i s i r r e t r i e v a b l y l o s t , a n d t h e r e c e i v e i n t e r r u p t f l a g ( r i ) i s n o t s e t . r e c e p t i o n f o r m o d e 2 i s s i m i l a r t o t h a t o f m o d e 1 . t h e e i g h t d a t a b y t e s a r e i n p u t a t r x d ( l s b f i r s t ) a n d l o a d e d o n t o t h e r e c e i v e s h i f t r e g i s t e r . i f t h e r e c e i v e d f r a m e h a s m e t t h e p r e v i o u s c r i t e r i a , t h e f o l l o w i n g e v e n t s o c c u r : x t h e e i g h t b i t s i n t h e r e c e i v e s h i f t r e g i s t e r a r e l a t c h e d i n t o t h e s b u f s f r . x t h e n i n t h d a t a b i t i s l a t c h e d i n t o r b 8 i n t h e s c o n s f r . x t h e r e c e i v e r i n t e r r u p t f l a g ( r i ) i s s e t . m o d e 3 ( 9 - b i t u a r t w i t h v a r i a b l e b a u d r a t e ) m o d e 3 i s s e l e c t e d b y s e t t i n g b o t h s m 0 a n d s m 1 . i n t h i s m o d e , t h e 8 0 5 2 u a r t s e r i a l p o r t o p e r a t e s i n 9 - b i t m o d e w i t h a v a r i a b l e b a u d r a t e . t h e b a u d r a t e i s s e t b y a t i m e r o v e r f l o w r a t e . t i m e r 1 o r t i m e r 2 c a n b e u s e d t o g e n e r a t e b a u d r a t e s , o r b o t h t i m e r s c a n b e u s e d s i m u l t a n e o u s l y , w h e r e o n e g e n e r a t e s t h e t r a n s m i t r a t e a n d t h e o t h e r g e n e r a t e s t h e r e c e i v e r a t e . t h e r e i s a l s o a d e d i c a t e d t i m e r f o r b a u d r a t e g e n e r a t i o n , t h e u a r t t i m e r , w h i c h h a s a f r a c t i o n a l d i v i s o r t o p r e c i s e l y g e n e r a t e a n y b a u d r a t e ( s e e t h e u a r t t i m e r g e n e r a t e d b a u d r a t e s s e c t i o n ) . t h e o p e r a t i o n o f t h e 9 - b i t u a r t i s t h e s a m e a s f o r m o d e 2 , b u t t h e b a u d r a t e c a n b e v a r i e d . i n a l l f o u r m o d e s , t r a n s m i s s i o n i s i n i t i a t e d b y a n y i n s t r u c t i o n t h a t u s e s s b u f a s a d e s t i n a t i o n r e g i s t e r . r e c e p t i o n i s i n i t i a t e d i n m o d e 0 w h e n r i = 0 a n d r e n = 1 . r e c e p t i o n i s i n i t i a t e d i n t h e o t h e r m o d e s b y t h e i n c o m i n g s t a r t b i t i f r e n = 1 . u a r t b a u d r a t e g e n e r a t i o n m o d e 0 b a u d r a t e g e n e r a t i o n t h e b a u d r a t e i n m o d e 0 i s f i x e d . ?1 ? 1 2 c o r e f d r a t e m o d e 0 b a u m o d e 2 b a u d r a t e g e n e r a t i o n t h e b a u d r a t e i n m o d e 2 d e p e n d s o n t h e v a l u e o f t h e p c o n [ 7 ] ( s m o d ) b i t i n t h e p r o g r a m c o n t r o l s f r ( p c o n , 0 x 8 7 ) . i f s m o d = 0 , t h e b a u d r a t e i s 1 / 3 2 o f t h e c o r e c l o c k . i f s m o d = 1 , t h e b a u d r a t e i s 1 / 1 6 o f t h e c o r e c l o c k . c o r e s m o d f r a t e b a u d m o d e u 3 2 2 2 m o d e 1 a n d m o d e 3 b a u d r a t e g e n e r a t i o n t h e b a u d r a t e s i n m o d e 1 a n d m o d e 3 a r e d e t e r m i n e d b y t h e o v e r f l o w r a t e o f t h e t i m e r g e n e r a t i n g t h e b a u d r a t e , t h a t i s , e i t h e r t i m e r 1 , t i m e r 2 , o r t h e d e d i c a t e d b a u d r a t e g e n e r a t o r , u a r t t i m e r , w h i c h h a s a n i n t e g e r a n d f r a c t i o n a l d i v i s o r . t i m e r 1 g e n e r a t e d b a u d r a t e s w h e n t i m e r 1 i s u s e d a s t h e b a u d r a t e g e n e r a t o r , t h e b a u d r a t e s i n m o d e 1 a n d m o d e 3 a r e d e t e r m i n e d b y t h e t i m e r 1 o v e r f l o w r a t e . t h e v a l u e o f s m o d i s a s f o l l o w s : m o d e 1 o r m o d e 3 b a u d r a t e = u 3 2 2 s m o d t i m e r 1 o v e r f l o w r a t e t h e t i m e r 1 i n t e r r u p t s h o u l d b e d i s a b l e d i n t h i s a p p l i c a t i o n . t h e t i m e r i t s e l f c a n b e c o n f i g u r e d f o r e i t h e r t i m e r o r c o u n t e r o p e r a t i o n , i n a n y o f i t s t h r e e r u n n i n g m o d e s . i n t h e m o s t t y p i c a l a p p l i c a t i o n , i t i s c o n f i g u r e d f o r t i m e r o p e r a t i o n i n a u t o r e l o a d m o d e ( h i g h n i b b l e o f t m o d = 0 0 1 0 b i n a r y ) . i n t h a t c a s e , t h e b a u d r a t e i s g i v e n b y t h e f o l l o w i n g f o r m u l a : m o d e 1 o r m o d e 3 b a u d r a t e = ) 2 5 6 ( 3 2 2 t h 1 f c o r e s m o d  u t i m e r 2 g e n e r a t e d b a u d r a t e s b a u d r a t e s c a n a l s o b e g e n e r a t e d b y u s i n g t i m e r 2 . u s i n g t i m e r 2 i s s i m i l a r t o u s i n g t i m e r 1 i n t h a t t h e t i m e r m u s t o v e r f l o w 1 6 t i m e s b e f o r e a b i t i s t r a n s m i t t e d o r r e c e i v e d . b e c a u s e t i m e r 2 h a s a 1 6 - b i t a u t o r e l o a d m o d e , a w i d e r r a n g e o f b a u d r a t e s i s p o s s i b l e . m o d e 1 o r m o d e 3 b a u d r a t e = 1 6 1 t i m e r 2 o v e r f l o w r a t e t h e r e f o r e , w h e n t i m e r 2 i s u s e d t o g e n e r a t e b a u d r a t e s , t h e t i m e r i n c r e m e n t s e v e r y t w o c l o c k c y c l e s r a t h e r t h a n e v e r y c o r e m a c h i n e c y c l e a s b e f o r e . i t i n c r e m e n t s s i x t i m e s f a s t e r t h a n t i m e r 1 , a n d , t h e r e f o r e , b a u d r a t e s s i x t i m e s f a s t e r a r e p o s s i b l e . b e c a u s e t i m e r 2 h a s 1 6 - b i t a u t o r e l o a d c a p a b i l i t y , v e r y l o w b a u d r a t e s a r e s t i l l p o s s i b l e . t i m e r 2 i s s e l e c t e d a s t h e b a u d r a t e g e n e r a t o r b y s e t t i n g t c l k a n d / o r r c l k i n t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) . t h e b a u d r a t e s f o r t r a n s m i t a n d r e c e i v e c a n b e s i m u l t a n e o u s l y d i f f e r e n t . s e t t i n g r c l k a n d / o r
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 0 o f 1 2 8 t c l k p u t s t i m e r 2 i n t o i t s b a u d r a t e g e n e r a t o r m o d e , a s s h o w n i n f i g u r e 9 2 . i n t h i s c a s e , t h e b a u d r a t e i s g i v e n b y t h e f o l l o w i n g f o r m u l a : m o d e 1 o r m o d e 3 b a u d r a t e = >@ l r c a p h r c a p f c o r e 2 : 2 6 5 5 3 6 1 6 u u a r t t i m e r g e n e r a t e d b a u d r a t e s t h e h i g h i n t e g e r d i v i d e r s i n a u a r t b l o c k m e a n t h a t h i g h s p e e d b a u d r a t e s a r e n o t a l w a y s p o s s i b l e . i n a d d i t i o n , g e n e r a t i n g b a u d r a t e s r e q u i r e s t h e e x c l u s i v e u s e o f a t i m e r , r e n d e r i n g i t u n u s a b l e f o r o t h e r a p p l i c a t i o n s w h e n t h e u a r t i s r e q u i r e d . t o a d d r e s s t h i s p r o b l e m , e a c h a d e 7 5 1 8 h a s a d e d i c a t e d b a u d r a t e t i m e r ( u a r t t i m e r ) s p e c i f i c a l l y f o r g e n e r a t i n g h i g h l y a c c u r a t e b a u d r a t e s . t h e u a r t t i m e r c a n b e u s e d i n s t e a d o f t i m e r 1 o r t i m e r 2 f o r g e n e r a t i n g v e r y a c c u r a t e h i g h s p e e d u a r t b a u d r a t e s , i n c l u d i n g 1 1 5 , 2 0 0 b p s . t h i s t i m e r a l s o a l l o w s a m u c h w i d e r r a n g e o f b a u d r a t e s t o b e o b t a i n e d . i n f a c t , e v e r y d e s i r e d b i t r a t e f r o m 1 2 b p s t o 3 9 3 , 2 1 6 b p s c a n b e g e n e r a t e d t o w i t h i n a n e r r o r o f 0 . 8 % . t h e u a r t t i m e r a l s o f r e e s u p t h e o t h e r t h r e e t i m e r s , a l l o w i n g t h e m t o b e u s e d f o r d i f f e r e n t a p p l i c a t i o n s . a b l o c k d i a g r a m o f t h e u a r t t i m e r i s s h o w n i n f i g u r e 9 1 . ( 1 + s b a u d f / 6 4 ) u a r t t i m e r r x / t x c l o c k f c o r e u a r t b a u d e n r x c l o c k t x c l o c k t i m e r 1 / t i m e r 2 r x c l o c k f r a c t i o n a l d i v i d e r 00 11 t i m e r 1 / t i m e r 2 t x c l o c k 3 2 2 d i v + s b t h 0 7 3 2 7 - 0 9 1 f i g u r e 9 1 . u a r t t i m e r , u a r t b a u d r a t e t w o s f r s , e n h a n c e d s e r i a l b a u d r a t e c o n t r o l s f r ( s b a u d t , 0 x 9 e ) a n d u a r t t i m e r f r a c t i o n a l d i v i d e r s f r ( s b a u d f , 0 x 9 d ) , a r e u s e d t o c o n t r o l t h e u a r t t i m e r . s b a u d t i s t h e b a u d r a t e c o n t r o l s f r ; i t s e t s u p t h e i n t e g e r d i v i d e r ( d i v ) a n d t h e e x t e n d e d d i v i d e r ( s b t h ) f o r t h e u a r t t i m e r . t h e a p p r o p r i a t e v a l u e t o w r i t e t o t h e d i v [ 2 : 0 ] a n d s b t h [ 1 : 0 ] b i t s c a n b e c a l c u l a t e d u s i n g t h e f o l l o w i n g f o r m u l a , w h e r e f c o r e i s d e f i n e d i n t h e p o w c o n s f r ( s e e t a b l e 2 4 ) . n o t e t h a t t h e d i v v a l u e m u s t b e r o u n d e d d o w n t o t h e n e a r e s t i n t e g e r . 2 l o g 1 6 l o g ? ?1 ? u  r a t e b a u d f s b t h d i v c o r e f c o r e t 2 p i n t r 2 c o n t r o l t l 2 ( 8 b i t s ) t h 2 ( 8 b i t s ) r e l o a d e x e n 2 c o n t r o l t 2 e x p i n t r a n s i t i o n d e t e c t o r e x f 2 t i m e r 2 i n t e r r u p t r c a p 2 l r c a p 2 h t i m e r 2 o v e r f l o w 2 1 6 1 6 r c l k t c l k r x c l o c k t x c l o c k 00 11 1 0 s m o d t i m e r 1 o v e r f l o w c / t 2 = 0 c / t 2 = 1 n o t e : a v a i l a b i l i t y o f a d d i t i o n a l e x t e r n a l i n t e r r u p t 0 7 3 2 7 - 0 9 2 f i g u r e 9 2 . t i m e r 2 , u a r t b a u d r a t e s
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 1 o f 1 2 8 s b a u d f i s t h e f r a c t i o n a l d i v i d e r r a t i o r e q u i r e d t o a c h i e v e t h e r e q u i r e d b a u d r a t e . t h e a p p r o p r i a t e v a l u e f o r s b a u d f c a n b e c a l c u l a t e d w i t h t h e f o l l o w i n g f o r m u l a : ? ?1 ?  u u u  1 2 1 6 6 4 r a t e b a u d f s b a u d f s b t h d i v c o r e n o t e t h a t s b a u d f s h o u l d b e r o u n d e d t o t h e n e a r e s t i n t e g e r . a f t e r t h e v a l u e s f o r d i v a n d s b a u d f a r e c a l c u l a t e d , t h e a c t u a l b a u d r a t e c a n b e c a l c u l a t e d w i t h t h e f o l l o w i n g f o r m u l a : ?1 ? u u  6 4 1 2 1 6 s b a u d f f r a t e b a u d a c t u a l s b t h d i v c o r e f o r e x a m p l e , t o o b t a i n a b a u d r a t e o f 9 6 0 0 b p s w h i l e o p e r a t i n g a t a c o r e c l o c k f r e q u e n c y o f 4 . 0 9 6 m h z w i t h t h e p l l c d b i t s e q u a l t o 0 , 4 7 4 . 4 2 l o g 9 6 0 0 1 6 4 , 0 9 6 , 0 0 0 l o g ?1 ? u  s b t h d i v n o t e t h a t t h e d i v r e s u l t i s r o u n d e d d o w n . 0 x 2 b 6 7 . 4 2 1 9 6 0 0 2 1 6 0 0 0 , 0 9 6 , 4 6 4 3 ?1 ?  uu u s b a u d f t h u s , t h e a c t u a l b a u d r a t e i s 9 5 7 0 b p s , r e s u l t i n g i n a 0 . 3 1 % e r r o r . u a r t a d d i t i o n a l f e a t u r e s e n h a n c e d e r r o r c h e c k i n g t h e e x t e n d e d u a r t p r o v i d e s f r a m e e r r o r , b r e a k e r r o r , a n d o v e r w r i t e e r r o r d e t e c t i o n . f r a m i n g e r r o r s o c c u r w h e n a s t o p b i t i s n o t p r e s e n t a t t h e e n d o f t h e f r a m e . a m i s s i n g s t o p b i t i m p l i e s t h a t t h e d a t a i n t h e f r a m e m a y n o t h a v e b e e n r e c e i v e d p r o p e r l y . b r e a k e r r o r d e t e c t i o n i n d i c a t e s w h e t h e r t h e r x l i n e h a s b e e n l o w f o r l o n g e r t h a n a 9 - b i t f r a m e . i t i n d i c a t e s t h a t t h e d a t a j u s t r e c e i v e d , a 0 o r n u l l c h a r a c t e r , i s n o t v a l i d b e c a u s e t h e m a s t e r h a s d i s c o n n e c t e d . o v e r w r i t e e r r o r d e t e c t i o n i n d i c a t e s w h e n t h e r e c e i v e d d a t a h a s n o t b e e n r e a d f a s t e n o u g h a n d , a s a r e s u l t , a b y t e o f d a t a h a s b e e n l o s t . t h e 8 0 5 2 s t a n d a r d u a r t o f f e r s f r a m e - e r r o r c h e c k i n g f o r a n 8 - b i t u a r t t h r o u g h t h e s m 2 a n d r b 8 b i t s . s e t t i n g t h e s m 2 b i t p r e v e n t s f r a m e s w i t h o u t a s t o p b i t f r o m b e i n g r e c e i v e d . t h e s t o p b i t i s l a t c h e d i n t o t h e r b 8 b i t i n t h e s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r s f r ( s c o n , 0 x 9 8 ) . t h i s b i t c a n b e e x a m i n e d t o d e t e r m i n e i f a v a l i d f r a m e w a s r e c e i v e d . t h e 8 0 5 2 d o e s n o t , h o w e v e r , p r o v i d e f r a m e e r r o r c h e c k i n g f o r a 9 - b i t u a r t . t h i s e n h a n c e d e r r o r c h e c k i n g f u n c t i o n a l i t y i s a v a i l a b l e t h r o u g h t h e f r a m e e r r o r b i t , f e , i n t h e e n h a n c e d s e r i a l b a u d r a t e c o n t r o l s f r ( s b a u d t , 0 x 9 e ) . t h e f e b i t i s s e t o n f r a m i n g e r r o r s f o r b o t h 8 - b i t a n d 9 - b i t u a r t s . r x r i f e e x t e n = 1 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 s t o p s t a r t 0 7 3 2 7 - 0 9 3 f i g u r e 9 3 . u a r t t i m i n g i n m o d e 1 r x r i f e e x t e n = 1 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 s t o p s t a r t 0 7 3 2 7 - 0 9 4 f i g u r e 9 4 . u a r t t i m i n g i n m o d e 2 a n d m o d e 3 t h e 8 0 5 2 s t a n d a r d u a r t d o e s n o t p r o v i d e b r e a k e r r o r d e t e c t i o n . h o w e v e r , f o r a n 8 - b i t u a r t , a b r e a k e r r o r c a n b e d e t e c t e d w h e n t h e r e c e i v e d c h a r a c t e r i s 0 , a n u l l c h a r a c t e r , a n d w h e n t h e r e i s a n o s t o p b i t b e c a u s e t h e r b 8 b i t i s l o w . b r e a k e r r o r d e t e c t i o n i s n o t p o s s i b l e f o r a 9 - b i t 8 0 5 2 u a r t b e c a u s e t h e s t o p b i t i s n o t r e c o r d e d . t h e a d e 7 5 1 8 e n h a n c e d b r e a k e r r o r d e t e c t i o n i s a v a i l a b l e t h r o u g h t h e b e b i t i n t h e s b a u d t s f r . t h e 8 0 5 2 s t a n d a r d u a r t p r e v e n t s o v e r w r i t e e r r o r s b y n o t a l l o w i n g a c h a r a c t e r t o b e r e c e i v e d w h e n t h e r e c e i v e i n t e r r u p t f l a g , r i , i s s e t . h o w e v e r , i t d o e s n o t i n d i c a t e i f a c h a r a c t e r h a s b e e n l o s t b e c a u s e t h e r i b i t i s s e t w h e n t h e f r a m e i s r e c e i v e d . t h e e n h a n c e d u a r t o v e r w r i t e e r r o r d e t e c t i o n p r o v i d e s t h i s i n f o r m a t i o n . w h e n t h e e n h a n c e d 8 0 5 2 u a r t i s e n a b l e d , a f r a m e i s r e c e i v e d r e g a r d l e s s o f t h e s t a t e o f t h e r i f l a g . i f r i = 1 w h e n a n e w b y t e i s r e c e i v e d , t h e b y t e i n s c o n i s o v e r w r i t t e n , a n d t h e o v e r w r i t e e r r o r f l a g i s s e t . t h e o v e r w r i t e e r r o r f l a g i s c l e a r e d w h e n s b u f i s r e a d . t h e e x t e n d e d u a r t i s e n a b l e d b y s e t t i n g t h e e x t e n b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) . u a r t t x d s i g n a l m o d u l a t i o n t h e r e i s a n i n t e r n a l 3 8 k h z s i g n a l t h a t c a n b e o r ? e d w i t h t h e u a r t t r a n s m i t s i g n a l f o r u s e i n r e m o t e c o n t r o l a p p l i c a t i o n s ( s e e t h e 3 8 k h z m o d u l a t i o n s e c t i o n ) . o n e o f t h e e v e n t s t h a t c a n w a k e t h e m c u f r o m s l e e p m o d e i s a c t i v i t y o n t h e r x d p i n ( s e e t h e 3 . 3 v p e r i p h e r a l s a n d w a k e - u p e v e n t s s e c t i o n ) .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 2 o f 1 2 8 s e r i a l p e r i p h e r a l i n t e r f a c e ( s p i ) t h e a d e 7 5 1 8 i n t e g r a t e s a c o m p l e t e h a r d w a r e s e r i a l p e r i p h e r a l i n t e r f a c e o n - c h i p . t h e s p i i s f u l l d u p l e x s o t h a t e i g h t b i t s o f d a t a a r e s y n c h r o n o u s l y t r a n s m i t t e d a n d s i m u l t a n e o u s l y r e c e i v e d . t h i s s p i i m p l e m e n t a t i o n i s d o u b l e b u f f e r e d , a l l o w i n g u s e r s t o r e a d t h e l a s t b y t e o f r e c e i v e d d a t a w h i l e a n e w b y t e i s s h i f t e d i n . t h e n e x t b y t e t o b e t r a n s m i t t e d c a n b e l o a d e d w h i l e t h e c u r r e n t b y t e i s s h i f t e d o u t . t h e s p i p o r t c a n b e c o n f i g u r e d f o r m a s t e r o r s l a v e o p e r a t i o n . t h e p h y s i c a l i n t e r f a c e t o t h e s p i i s v i a t h e m i s o ( p 0 . 5 ) , m o s i ( p 0 . 4 ) , s c l k ( p 0 . 6 ) , a n d s s ( p 0 . 7 ) p i n s , w h e r e a s t h e f i r m w a r e i n t e r f a c e i s v i a t h e s p i c o n f i g u r a t i o n s f r 1 ( s p i m o d 1 , 0 x e 8 ) , t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) , t h e s p i i n t e r r u p t s t a t u s s f r ( s p i s t a t , 0 x e a ) , t h e s p i / i 2 c t r a n s m i t b u f f e r s f r ( s p i 2 c t x , 0 x 9 a ) , a n d t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) . n o t e t h a t t h e s p i p i n s a r e s h a r e d w i t h t h e i 2 c p i n s . t h e r e f o r e , t h e u s e r c a n e n a b l e o n l y o n e i n t e r f a c e a t a t i m e . t h e s c p s b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) s e l e c t s w h i c h p e r i p h e r a l i s a c t i v e . s p i r e g i s t e r s t a b l e 1 2 6 . s p i s f r l i s t s f r a d d r e s s n a m e r / w l e n g t h ( b i t s ) d e f a u l t d e s c r i p t i o n 0 x 9 a s p i 2 c t x w 8 0 s p i / i 2 c t r a n s m i t b u f f e r ( s e e t a b l e 1 2 7 ) . 0 x 9 b s p i 2 c r x r 8 0 s p i / i 2 c r e c e i v e b u f f e r ( s e e t a b l e 1 2 8 ) . 0 x e 8 s p i m o d 1 r / w 8 0 x 1 0 s p i c o n f i g u r a t i o n s f r 1 ( s e e t a b l e 1 2 9 ) . 0 x e 9 s p i m o d 2 r / w 8 0 s p i c o n f i g u r a t i o n s f r 2 ( s e e t a b l e 1 3 0 ) . 0 x e a s p i s t a t r / w 8 0 s p i i n t e r r u p t s t a t u s ( s e e t a b l e 1 3 1 ) . t a b l e 1 2 7 . s p i / i 2 c t r a n s m i t b u f f e r s f r ( s p i 2 c t x , 0 x 9 a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s p i 2 c t x 0 s p i o r i 2 c t r a n s m i t b u f f e r . w h e n s p i 2 c t x s f r i s w r i t t e n , i t s c o n t e n t i s t r a n s f e r r e d t o t h e t r a n s m i t f i f o i n p u t . w h e n a w r i t e i s r e q u e s t e d , t h e f i f o o u t p u t i s s e n t o n t h e s p i o r i 2 c b u s . t a b l e 1 2 8 . s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 0 s p i 2 c r x 0 s p i o r i 2 c r e c e i v e b u f f e r . w h e n s p i 2 c r x s f r i s r e a d , o n e b y t e f r o m t h e r e c e i v e f i f o o u t p u t i s t r a n s f e r r e d t o t h e s p i 2 c r x s f r . a n e w d a t a b y t e f r o m t h e s p i o r i 2 c b u s i s w r i t t e n t o t h e f i f o i n p u t .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 3 o f 1 2 8 t a b l e 1 2 9 . s p i c o n f i g u r a t i o n s f r 1 ( s p i m o d 1 , 0 x e 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 0 x e f t o 0 x e e r e s e r v e d 0 r e s e r v e d . 5 0 x e d i n t m o d 0 s p i i n t e r r u p t m o d e . i n t m o d r e s u l t 0 s p i i n t e r r u p t i s s e t w h e n s p i r x b u f f e r i s f u l l . 1 s p i i n t e r r u p t i s s e t w h e n s p i t x b u f f e r i s e m p t y . 4 0 x e c a u t o _ s s 1 m a s t e r m o d e , s s o u t p u t c o n t r o l ( s e e f i g u r e 9 5 ) . a u t o _ s s r e s u l t 0 t h e s s p i n i s h e l d l o w w h i l e t h i s b i t i s c l e a r e d . t h i s a l l o w s m a n u a l c h i p s e l e c t c o n t r o l u s i n g t h e s s p i n . 1 s i n g l e b y t e r e a d o r w r i t e . t h e s s p i n g o e s l o w d u r i n g a s i n g l e b y t e t r a n s m i s s i o n a n d t h e n r e t u r n s h i g h . c o n t i n u o u s t r a n s f e r . t h e s s p i n g o e s l o w d u r i n g t h e d u r a t i o n o f t h e m u l t i b y t e c o n t i n u o u s t r a n s f e r a n d t h e n r e t u r n s h i g h . 3 0 x e b s s _ e n 0 s l a v e m o d e , s s i n p u t e n a b l e . w h e n t h i s b i t i s s e t t o l o g i c 1 , t h e s s p i n i s d e f i n e d a s t h e s l a v e s e l e c t i n p u t p i n f o r t h e s p i s l a v e i n t e r f a c e . 2 0 x e a r x o f w 0 r e c e i v e b u f f e r o v e r f l o w w r i t e e n a b l e . r x o f w r e s u l t 0 i f t h e s p i 2 c r x s f r h a s n o t b e e n r e a d w h e n a n e w d a t a b y t e i s r e c e i v e d , t h e n e w b y t e i s d i s c a r d e d . 1 i f t h e s p i 2 c r x s f r h a s n o t b e e n r e a d w h e n a n e w d a t a b y t e i s r e c e i v e d , t h e n e w b y t e o v e r w r i t e s t h e o l d d a t a . 1 t o 0 0 x e 9 t o 0 x e 8 s p i r [ 1 : 0 ] 0 m a s t e r m o d e , s p i s c l k f r e q u e n c y . s p i r [ 1 : 0 ] r e s u l t 0 0 f c o r e / 8 = 5 1 2 k h z ( i f f c o r e = 4 . 0 9 6 m h z ) . 0 1 f c o r e / 1 6 = 2 5 6 k h z ( i f f c o r e = 4 . 0 9 6 m h z ) . 1 0 f c o r e / 3 2 = 1 2 8 k h z ( i f f c o r e = 4 . 0 9 6 m h z ) . 1 1 f c o r e / 6 4 = 6 4 k h z ( i f f c o r e = 4 . 0 9 6 m h z ) .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 4 o f 1 2 8 t a b l e 1 3 0 . s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 s p i c o n t 0 m a s t e r m o d e , s p i c o n t i n u o u s t r a n s f e r m o d e e n a b l e b i t . s p i c o n t r e s u l t 0 t h e s p i i n t e r f a c e s t o p s a f t e r o n e b y t e i s t r a n s f e r r e d a n d s s i s d e a s s e r t e d . a n e w d a t a t r a n s f e r c a n b e i n i t i a t e d a f t e r a s t a l l e d p e r i o d . 1 t h e s p i i n t e r f a c e c o n t i n u e s t o t r a n s f e r d a t a u n t i l n o v a l i d d a t a i s a v a i l a b l e i n t h e s p i 2 c t x s f r . s s r e m a i n s a s s e r t e d u n t i l t h e s p i 2 c t x s f r a n d t h e t r a n s m i t s h i f t r e g i s t e r s a r e e m p t y . 6 s p i e n 0 s p i i n t e r f a c e e n a b l e b i t . s p i e n r e s u l t 0 t h e s p i i n t e r f a c e i s d i s a b l e d . 1 t h e s p i i n t e r f a c e i s e n a b l e d . 5 s p i o d o 0 s p i o p e n - d r a i n o u t p u t c o n f i g u r a t i o n b i t . s p i o d o r e s u l t 0 i n t e r n a l p u l l - u p r e s i s t o r s a r e c o n n e c t e d t o t h e s p i o u t p u t s . 1 t h e s p i o u t p u t s a r e o p e n d r a i n a n d n e e d e x t e r n a l p u l l - u p r e s i s t o r s . t h e p u l l - u p v o l t a g e s h o u l d n o t e x c e e d t h e s p e c i f i e d o p e r a t i n g v o l t a g e . 4 s p i m s _ b 0 s p i m a s t e r m o d e e n a b l e b i t . s p i m s _ b r e s u l t 0 t h e s p i i n t e r f a c e i s d e f i n e d a s a s l a v e . 1 t h e s p i i n t e r f a c e i s d e f i n e d a s a m a s t e r . 3 s p i c p o l 0 s p i c l o c k p o l a r i t y c o n f i g u r a t i o n b i t ( s e e f i g u r e 9 7 ) . s p i c p o l r e s u l t 0 t h e d e f a u l t s t a t e o f s c l k i s l o w , a n d t h e f i r s t s c l k e d g e i s r i s i n g . d e p e n d i n g o n t h e s p i c p h a b i t , t h e s p i d a t a o u t p u t c h a n g e s s t a t e o n t h e f a l l i n g o r r i s i n g e d g e o f s c l k w h i l e t h e s p i d a t a i n p u t i s s a m p l e d o n t h e r i s i n g o r f a l l i n g e d g e o f s c l k . 1 t h e d e f a u l t s t a t e o f s c l k i s h i g h , a n d t h e f i r s t s c l k e d g e i s f a l l i n g . d e p e n d i n g o n t h e s p i c p h a b i t , t h e s p i d a t a o u t p u t c h a n g e s s t a t e o n t h e r i s i n g o r f a l l i n g e d g e o f s c l k w h i l e t h e s p i d a t a i n p u t i s s a m p l e d o n t h e f a l l i n g o r r i s i n g e d g e o f s c l k . 2 s p i c p h a 0 s p i c l o c k p h a s e c o n f i g u r a t i o n b i t ( s e e f i g u r e 9 7 ) . s p i c p h a r e s u l t 0 t h e s p i d a t a o u t p u t c h a n g e s s t a t e w h e n s s g o e s l o w a t t h e s e c o n d e d g e o f s c l k a n d t h e n e v e r y t w o s u b s e q u e n t e d g e s , w h e r e a s t h e s p i d a t a i n p u t i s s a m p l e d a t t h e f i r s t s c l k e d g e a n d t h e n e v e r y t w o s u b s e q u e n t e d g e s . 1 t h e s p i d a t a o u t p u t c h a n g e s s t a t e a t t h e f i r s t e d g e o f s c l k a n d t h e n e v e r y t w o s u b s e q u e n t e d g e s , w h e r e a s t h e s p i d a t a i n p u t i s s a m p l e d a t t h e s e c o n d s c l k e d g e a n d t h e n e v e r y t w o s u b s e q u e n t e d g e s . 1 s p i l s b f 0 m a s t e r m o d e , l s b f i r s t c o n f i g u r a t i o n b i t . s p i l s b f r e s u l t 0 t h e m s b o f t h e s p i o u t p u t s i s t r a n s m i t t e d f i r s t . 1 t h e l s b o f t h e s p i o u t p u t s i s t r a n s m i t t e d f i r s t . 0 t i m o d e 1 t r a n s f e r a n d i n t e r r u p t m o d e o f t h e s p i i n t e r f a c e . t i m o d e r e s u l t 1 t h i s b i t m u s t b e l e f t s e t f o r p r o p e r o p e r a t i o n .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 5 o f 1 2 8 t a b l e 1 3 1 . s p i i n t e r r u p t s t a t u s s f r ( s p i s t a t , 0 x e a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 b u s y 0 s p i p e r i p h e r a l b u s y f l a g . b u s y r e s u l t 0 t h e s p i p e r i p h e r a l i s i d l e . 1 t h e s p i p e r i p h e r a l i s b u s y t r a n s f e r r i n g d a t a i n s l a v e o r m a s t e r m o d e . 6 m m e r r 0 s p i m u l t i m a s t e r e r r o r f l a g . m m e r r r e s u l t 0 a m u l t i p l e m a s t e r e r r o r h a s n o t o c c u r r e d . 1 i f t h e s s _ e n b i t i s s e t , e n a b l i n g t h e s l a v e s e l e c t i n p u t a n d a s s e r t i n g t h e s s p i n w h i l e t h e s p i p e r i p h e r a l i s t r a n s f e r r i n g d a t a a s a m a s t e r , t h i s f l a g i s r a i s e d t o i n d i c a t e t h e e r r o r . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 5 s p i r x o f 0 s p i r e c e i v e o v e r f l o w e r r o r f l a g . r e a d i n g t h e s p i 2 c r x s f r c l e a r s t h i s b i t . s p i r x o f t i m o d e r e s u l t 0 x t h e s p i 2 c r x r e g i s t e r c o n t a i n s v a l i d d a t a . 1 1 t h i s b i t i s s e t i f t h e s p i 2 c r x r e g i s t e r i s n o t r e a d b e f o r e t h e e n d o f t h e n e x t b y t e t r a n s f e r . i f t h e r x o f w b i t i s s e t a n d t h i s c o n d i t i o n o c c u r s , s p i 2 c r x i s o v e r w r i t t e n . 4 s p i r x i r q 0 s p i r e c e i v e m o d e i n t e r r u p t f l a g . r e a d i n g t h e s p i 2 c r x s f r c l e a r s t h i s b i t . s p i r x i r q t i m o d e r e s u l t 0 x t h e s p i 2 c r x r e g i s t e r d o e s n o t c o n t a i n n e w d a t a . 1 0 t h i s b i t i s s e t w h e n t h e s p i 2 c r x r e g i s t e r c o n t a i n s n e w d a t a . i f t h e s p i / i 2 c i n t e r r u p t i s e n a b l e d , a n i n t e r r u p t i s g e n e r a t e d w h e n t h i s b i t i s s e t . i f t h e s p i 2 c r x r e g i s t e r i s n o t r e a d b e f o r e t h e e n d o f t h e c u r r e n t b y t e t r a n s f e r , t h e t r a n s f e r s t o p s a n d t h e s s p i n i s d e a s s e r t e d . 1 1 t h e s p i 2 c r x r e g i s t e r c o n t a i n s n e w d a t a . 3 s p i r x b f 0 s t a t u s b i t f o r s p i r x b u f f e r . w h e n s e t , t h e r x f i f o i s f u l l . a r e a d o f t h e s p i 2 c r x c l e a r s t h i s f l a g . 2 s p i t x u f 0 s t a t u s b i t f o r s p i t x b u f f e r . w h e n s e t , t h e t x f i f o i s u n d e r f l o w i n g a n d d a t a c a n b e w r i t t e n i n t o s p i 2 c t x . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 1 s p i t x i r q 0 s p i t r a n s m i t m o d e i n t e r r u p t f l a g . w r i t i n g n e w d a t a t o t h e s p i 2 c t x s f r c l e a r s t h i s b i t . s p i t x i r q t i m o d e r e s u l t 0 x t h e s p i 2 c t x r e g i s t e r i s f u l l . 1 0 t h e s p i 2 c t x r e g i s t e r i s e m p t y . 1 1 t h i s b i t i s s e t w h e n t h e s p i 2 c t x r e g i s t e r i s e m p t y . i f t h e s p i / i 2 c i n t e r r u p t i s e n a b l e d , a n i n t e r r u p t i s g e n e r a t e d w h e n t h i s b i t i s s e t . i f n e w d a t a i s n o t w r i t t e n i n t o t h e s p i 2 c t x s f r b e f o r e t h e e n d o f t h e c u r r e n t b y t e t r a n s f e r , t h e t r a n s f e r s t o p s , a n d t h e s s p i n i s d e a s s e r t e d . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 0 s p i t x b f 0 s t a t u s b i t f o r s p i t x b u f f e r . w h e n s e t , t h e s p i t x b u f f e r i s f u l l . w r i t e a 0 t o t h i s b i t t o c l e a r i t . s p i p i n s m i s o ( m a s t e r i n , s l a v e o u t d a t a i / o p i n ) t h e m i s o p i n i s c o n f i g u r e d a s a n i n p u t l i n e i n m a s t e r m o d e a n d a s a n o u t p u t l i n e i n s l a v e m o d e . t h e m i s o l i n e o n t h e m a s t e r ( d a t a i n ) s h o u l d b e c o n n e c t e d t o t h e m i s o l i n e i n t h e s l a v e d e v i c e ( d a t a o u t ) . t h e d a t a i s t r a n s f e r r e d a s b y t e - w i d e ( 8 - b i t ) s e r i a l d a t a , m s b f i r s t . m o s i ( m a s t e r o u t , s l a v e i n p i n ) t h e m o s i p i n i s c o n f i g u r e d a s a n o u t p u t l i n e i n m a s t e r m o d e a n d a s a n i n p u t l i n e i n s l a v e m o d e . t h e m o s i l i n e o n t h e m a s t e r ( d a t a o u t ) s h o u l d b e c o n n e c t e d t o t h e m o s i l i n e i n t h e s l a v e d e v i c e ( d a t a i n ) . t h e d a t a i s t r a n s f e r r e d a s b y t e - w i d e ( 8 - b i t ) s e r i a l d a t a , m s b f i r s t . s c l k ( s e r i a l c l o c k i / o p i n ) t h e m a s t e r s e r i a l c l o c k ( s c l k ) i s u s e d t o s y n c h r o n i z e t h e d a t a b e i n g t r a n s m i t t e d a n d r e c e i v e d t h r o u g h t h e m o s i a n d m i s o d a t a l i n e s . t h e s c l k p i n i s c o n f i g u r e d a s a n o u t p u t i n m a s t e r m o d e a n d a s a n i n p u t i n s l a v e m o d e . i n m a s t e r m o d e , t h e b i t r a t e , p o l a r i t y , a n d p h a s e o f t h e c l o c k a r e c o n t r o l l e d b y t h e s p i c o n f i g u r a t i o n s f r 1 ( s p i m o d 1 , 0 x e 8 ) a n d s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . i n s l a v e m o d e , t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) m u s t b e c o n f i g u r e d w i t h t h e p h a s e a n d p o l a r i t y o f t h e e x p e c t e d i n p u t c l o c k . i n b o t h m a s t e r a n d s l a v e m o d e s , t h e d a t a i s t r a n s m i t t e d o n o n e e d g e o f t h e s c l k s i g n a l a n d s a m p l e d o n t h e o t h e r . i t i s i m p o r t a n t , t h e r e f o r e , t h a t t h e s p i c p h a a n d s p i c p o l b i t s b e c o n f i g u r e d t h e s a m e f o r t h e m a s t e r a n d s l a v e d e v i c e s .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 6 o f 1 2 8 s s ( s l a v e s e l e c t p i n ) i n s p i s l a v e m o d e , a t r a n s f e r i s i n i t i a t e d b y t h e a s s e r t i o n o f s s l o w . t h e s p i p o r t t h e n t r a n s m i t s a n d r e c e i v e s 8 - b i t d a t a u n t i l t h e d a t a i s c o n c l u d e d b y t h e d e a s s e r t i o n o f s s a c c o r d i n g t o t h e s p i c o n b i t s e t t i n g . i n s l a v e m o d e , s s i s a l w a y s a n i n p u t . i n s p i m a s t e r m o d e , t h e s s c a n b e u s e d t o c o n t r o l d a t a t r a n s f e r t o a s l a v e d e v i c e . i n a u t o m a t i c s l a v e s e l e c t c o n t r o l m o d e , t h e s s i s a s s e r t e d l o w t o s e l e c t t h e s l a v e d e v i c e a n d t h e n r a i s e d t o d e s e l e c t t h e s l a v e d e v i c e a f t e r t h e t r a n s f e r i s c o m p l e t e . a u t o m a t i c s l a v e s e l e c t c o n t r o l i s e n a b l e d b y s e t t i n g t h e a u t o _ s s b i t i n t h e s p i c o n f i g u r a t i o n s f r 1 ( s p i m o d 1 , 0 x e 8 ) . i n a m u l t i m a s t e r s y s t e m , t h e s s c a n b e c o n f i g u r e d a s a n i n p u t s o t h a t t h e s p i p e r i p h e r a l c a n o p e r a t e a s a s l a v e i n s o m e s i t u a t i o n s a n d a s a m a s t e r i n o t h e r s . i n t h i s c a s e , t h e s l a v e s e l e c t s f o r t h e s l a v e s t h a t a r e c o n t r o l l e d b y t h i s s p i p e r i p h e r a l s h o u l d b e g e n e r - a t e d w i t h g e n e r a l i / o p i n s . s p i m a s t e r o p e r a t i n g m o d e s t h e d o u b l e - b u f f e r e d r e c e i v e a n d t r a n s m i t r e g i s t e r s c a n b e u s e d t o m a x i m i z e t h e t h r o u g h p u t o f t h e s p i p e r i p h e r a l b y c o n t i n u o u s l y s t r e a m i n g o u t d a t a i n m a s t e r m o d e . c o n t i n u o u s t r a n s m i t m o d e i s d e s i g n e d t o u s e t h e f u l l c a p a c i t y o f t h e s p i . i n t h i s m o d e , t h e m a s t e r t r a n s m i t s a n d r e c e i v e s d a t a u n t i l t h e s p i / i 2 c t r a n s m i t b u f f e r s f r ( s p i 2 c t x , 0 x 9 a ) i s e m p t y a t t h e s t a r t o f a b y t e t r a n s f e r . c o n t i n u o u s m o d e i s e n a b l e d b y s e t t i n g t h e s p i c o n t b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . t h e s p i p e r i p h e r a l a l s o o f f e r s a s i n g l e b y t e r e a d / w r i t e f u n c t i o n . i n m a s t e r m o d e , t h e t y p e o f t r a n s f e r i s h a n d l e d a u t o m a t i c a l l y , d e p e n d i n g o n t h e c o n f i g u r a t i o n o f t h e s p i c o n t b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . t h e f o l l o w i n g p r o c e - d u r e s s h o w t h e s e q u e n c e o f e v e n t s t h a t s h o u l d b e p e r f o r m e d f o r e a c h m a s t e r o p e r a t i n g m o d e . b a s e d o n t h e s s c o n f i g u r a t i o n , s o m e o f t h e s e e v e n t s t a k e p l a c e a u t o m a t i c a l l y . p r o c e d u r e s f o r u s i n g s p i a s a m a s t e r s i n g l e b y t e m o d e ? s p i c o n t ( s p i m o d 2 [ 7 ] ) = 0 1 . w r i t e t o s p i 2 c t x s f r . 2 . s s i s a s s e r t e d l o w a n d a w r i t e r o u t i n e i s i n i t i a t e d . 3 . s p i t x i r q i n t e r r u p t f l a g i s s e t w h e n t h e s p i 2 c t x r e g i s t e r i s e m p t y . 4 . s s i s d e a s s e r t e d h i g h . 5 . w r i t e t o s p i 2 c t x s f r t o c l e a r t h e s p i t x i r q i n t e r r u p t f l a g . c o n t i n u o u s b y t e m o d e ? s p i c o n t ( s p i m o d 2 [ 7 ] ) = 1 1 . w r i t e t o s p i 2 c t x s f r . 2 . s s i s a s s e r t e d l o w a n d w r i t e r o u t i n e i s i n i t i a t e d . 3 . w a i t f o r t h e s p i t x i r q i n t e r r u p t f l a g t o w r i t e t o s p i 2 c t x s f r . t r a n s f e r c o n t i n u e s u n t i l t h e s p i 2 c t x r e g i s t e r a n d t r a n s m i t s h i f t r e g i s t e r s a r e e m p t y . 4 . s p i t x i r q i n t e r r u p t f l a g i s s e t w h e n t h e s p i 2 c t x r e g i s t e r i s e m p t y . 5 . s s i s d e a s s e r t e d h i g h . 6 . w r i t e t o s p i 2 c t x s f r t o c l e a r t h e s p i t x i r q i n t e r r u p t f l a g . f i g u r e 9 5 s h o w s t h e s p i o u t p u t f o r c e r t a i n a u t o m a t i c c h i p s e l e c t a n d c o n t i n u o u s m o d e s e l e c t i o n s . n o t e t h a t i f t h e c o n t i n u o u s m o d e i s n o t u s e d , a s h o r t d e l a y i s i n s e r t e d b e t w e e n t r a n s f e r s . s c l k s s d o u t d i n d i n 1 d i n 2 a u t o _ s s = 1 s p i c o n t = 0 s c l k s s d o u t d i n d i n 1 a u t o _ s s = 1 s p i c o n t = 1 d i n 2 a u t o _ s s = 0 s p i c o n t = 0 ( m a n u a l s s c o n t r o l ) d o u t 1 d o u t 2 d o u t 1 d o u t 2 s c l k s s d o u t d i n d i n 1 d i n 2 d o u t 1 d o u t 2 0 7 3 2 7 - 0 9 5 f i g u r e 9 5 . a u t o m a t i c c h i p s e l e c t a n d c o n t i n u o u s m o d e o u t p u t n o t e t h a t r e a d i n g t h e c o n t e n t o f t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) s h o u l d b e d o n e u s i n g a 2 - c y c l e i n s t r u c t i o n s e t , s u c h a s m o v a o r s p i 2 c r x . u s i n g a 3 - c y c l e i n s t r u c t i o n , s u c h a s m o v 0 x 3 d o r s p i 2 c r x , d o e s n o t t r a n s f e r t h e c o r r e c t i n f o r m a - t i o n i n t o t h e t a r g e t r e g i s t e r .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 7 o f 1 2 8 s p i i n t e r r u p t a n d s t a t u s f l a g s t h e s p i i n t e r f a c e h a s s e v e r a l s t a t u s f l a g s t h a t i n d i c a t e t h e s t a t u s o f t h e d o u b l e - b u f f e r e d r e c e i v e a n d t r a n s m i t r e g i s t e r s . f i g u r e 9 6 s h o w s w h e n t h e s t a t u s a n d i n t e r r u p t f l a g s a r e r a i s e d . t h e t r a n s m i t i n t e r r u p t o c c u r s w h e n t h e t r a n s m i t s h i f t r e g i s t e r i s l o a d e d w i t h t h e d a t a i n t h e s p i / i 2 c t r a n s m i t b u f f e r s f r ( s p i 2 c t x , 0 x 9 a ) . i f t h e s p i m a s t e r i s i n t r a n s m i t o p e r a t i n g m o d e , a n d t h e s p i / i 2 c t r a n s m i t b u f f e r s f r ( s p i 2 c t x , 0 x 9 a ) r e g i s t e r h a s n o t b e e n w r i t t e n w i t h n e w d a t a b y t h e b e g i n n i n g o f t h e n e x t b y t e t r a n s f e r , t h e t r a n s m i t o p e r a t i o n s t o p s . w h e n a n e w b y t e o f d a t a i s r e c e i v e d i n t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) , t h e s p i r e c e i v e i n t e r r u p t f l a g i s r a i s e d . i f t h e d a t a i n t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) i s n o t r e a d b e f o r e n e w d a t a i s r e a d y t o b e l o a d e d i n t o t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) , a n o v e r f l o w c o n d i t i o n h a s o c c u r r e d . t h i s o v e r f l o w c o n d i t i o n , i n d i c a t e d b y t h e s p i r x o f f l a g , f o r c e s t h e n e w d a t a t o b e d i s c a r d e d o r o v e r w r i t t e n i f t h e r x o f w b i t i s s e t . s p i t x t r a n s m i t s h i f t r e g i s t e r s p i t x i r q = 1 s p i t x ( e m p t y ) t r a n s m i t s h i f t r e g i s t e r s t o p s t r a n s f e r i f t i m o d e = 1 s p i r x r e c e i v e s h i f t r e g i s t e r s p i r x i r q = 1 s p i r x ( f u l l ) r e c e i v e s h i f t r e g i s t e r s p i r x o f = 1 0 7 3 2 7 - 0 9 6 f i g u r e 9 6 . s p i r e c e i v e a n d t r a n s m i t i n t e r r u p t a n d s t a t u s f l a g s s c l k ( s p i c p o l = 0 ) m i s o s c l k ( s p i c p o l = 1 ) m o s i s p i r x a n d s p i t x f l a g s w i t h i n t m o d = 1 s p i r x a n d s p i t x f l a g s w i t h i n t m o d = 0 s s s p i r x a n d s p i t x f l a g s w i t h i n t m o d = 0 s p i c p h a = 1 m s b b i t 6 b i t 5 b i t 4 b i t 3 b i t 2 b i t 1 l s b ? m s b b i t 6 b i t 5 b i t 4 b i t 3 b i t 2 b i t 1 l s b ? m s b b i t 6 b i t 5 b i t 4 b i t 3 b i t 2 b i t 1 l s b ? m s b b i t 6 b i t 5 b i t 4 b i t 3 b i t 2 b i t 1 l s b ? m i s o m o s i s p i r x a n d s p i t x f l a g s w i t h i n t m o d = 1 s p i c p h a = 0 0 7 3 2 7 - 0 9 7 f i g u r e 9 7 . s p i t i m i n g c o n f i g u r a t i o n s
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 8 o f 1 2 8 i 2 c - c o m p a t i b l e i n t e r f a c e t h e a d e 7 5 1 8 s u p p o r t s a f u l l y l i c e n s e d i 2 c i n t e r f a c e . t h e i 2 c i n t e r f a c e i s i m p l e m e n t e d a s a f u l l h a r d w a r e m a s t e r . s d a t a i s t h e d a t a i / o p i n , a n d s c l k i s t h e s e r i a l c l o c k . t h e s e t w o p i n s a r e s h a r e d w i t h t h e m o s i a n d s c l k p i n s o f t h e o n - c h i p s p i i n t e r f a c e . t h e r e f o r e , t h e u s e r c a n e n a b l e o n l y o n e i n t e r f a c e o n t h e s e p i n s a t a n y g i v e n t i m e . t h e s c p s b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) s e l e c t s w h i c h p e r i p h e r a l i s a c t i v e . t h e t w o p i n s u s e d f o r d a t a t r a n s f e r , s d a t a a n d s c l k , a r e c o n f i g u r e d i n a w i r e - a n d f o r m a t t h a t a l l o w s a r b i t r a t i o n i n a m u l t i m a s t e r s y s t e m . t h e t r a n s f e r s e q u e n c e o f a n i 2 c s y s t e m c o n s i s t s o f a m a s t e r d e v i c e i n i t i a t i n g a t r a n s f e r b y g e n e r a t i n g a s t a r t c o n d i t i o n w h i l e t h e b u s i s i d l e . t h e m a s t e r t r a n s m i t s t h e a d d r e s s o f t h e s l a v e d e v i c e a n d t h e d i r e c t i o n o f t h e d a t a t r a n s f e r i n t h e i n i t i a l a d d r e s s t r a n s f e r . i f t h e s l a v e a c k n o w l e d g e s t h e s t a r t c o n d i t i o n , t h e d a t a t r a n s f e r i s i n i t i a t e d . t h i s c o n t i n u e s u n t i l t h e m a s t e r i s s u e s a s t o p c o n d i t i o n a n d t h e b u s b e c o m e s i d l e . s e r i a l c l o c k g e n e r a t i o n t h e i 2 c m a s t e r i n t h e s y s t e m g e n e r a t e s t h e s e r i a l c l o c k f o r a t r a n s f e r . t h e m a s t e r c h a n n e l c a n b e c o n f i g u r e d t o o p e r a t e i n f a s t m o d e ( 2 5 6 k h z ) o r s t a n d a r d m o d e ( 3 2 k h z ) . t h e b i t r a t e i s d e f i n e d i n t h e i 2 c m o d s f r a s f o l l o w s : ] 0 : 1 [ 2 2 1 6 c r i c o r e s c l k f f u s l a v e a d d r e s s e s t h e i 2 c s l a v e a d d r e s s s f r ( i 2 c a d r , 0 x e 9 ) c o n t a i n s t h e s l a v e d e v i c e i d . t h e l s b o f t h i s r e g i s t e r c o n t a i n s a r e a d / w r i t e r e q u e s t . a w r i t e t o t h i s s f r s t a r t s t h e i 2 c c o m m u n i c a t i o n . i 2 c r e g i s t e r s t h e i 2 c p e r i p h e r a l i n t e r f a c e c o n s i s t s o f f i v e s f r s . x i 2 c m o d x s p i 2 c s t a t x i 2 c a d r x s p i 2 c t x x s p i 2 c r x b e c a u s e t h e s p i a n d i 2 c s e r i a l i n t e r f a c e s s h a r e t h e s a m e p i n s , t h e y a l s o s h a r e t h e s a m e s f r s , s u c h a s t h e s p i 2 c t x a n d s p i 2 c r x s f r s . i n a d d i t i o n , t h e i 2 c m o d , i 2 c a d r , a n d s p i 2 c s t a t s f r s a r e s h a r e d w i t h t h e s p i m o d 1 , s p i m o d 2 , a n d s p i s t a t s f r s , r e s p e c t i v e l y . t a b l e 1 3 2 . i 2 c s f r l i s t s f r a d d r e s s n a m e r / w l e n g t h d e f a u l t d e s c r i p t i o n 0 x 9 a s p i 2 c t x w 8 0 s p i / i 2 c t r a n s m i t b u f f e r ( s e e t a b l e 1 2 7 ) . 0 x 9 b s p i 2 c r x r 8 0 s p i / i 2 c r e c e i v e b u f f e r ( s e e t a b l e 1 2 8 ) . 0 x e 8 i 2 c m o d r / w 8 0 i 2 c m o d e ( s e e t a b l e 1 3 3 ) . 0 x e 9 i 2 c a d r r / w 8 0 i 2 c s l a v e a d d r e s s ( s e e t a b l e 1 3 4 ) . 0 x e a s p i 2 c s t a t r / w 8 0 i 2 c i n t e r r u p t s t a t u s r e g i s t e r ( s e e t a b l e 1 3 5 ) . t a b l e 1 3 3 . i 2 c m o d e s f r ( i 2 c m o d , 0 x e 8 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 7 0 x e f i 2 c e n 0 i 2 c e n a b l e b i t . w h e n t h i s b i t i s s e t t o l o g i c 1 , t h e i 2 c i n t e r f a c e i s e n a b l e d . a w r i t e t o t h e i 2 c a d r s f r s t a r t s a c o m m u n i c a t i o n . 6 t o 5 0 x e e t o 0 x e d i 2 c r [ 1 : 0 ] 0 0 i 2 c s c l k f r e q u e n c y . i 2 c r [ 1 : 0 ] r e s u l t 0 0 f c o r e / 1 6 = 2 5 6 k h z i f f c o r e = 4 . 0 9 6 m h z . 0 1 f c o r e / 3 2 = 1 2 8 k h z i f f c o r e = 4 . 0 9 6 m h z . 1 0 f c o r e / 6 4 = 6 4 h z i f f c o r e = 4 . 0 9 6 m h z . 1 1 f c o r e / 1 2 8 = 3 2 k h z i f f c o r e = 4 . 0 9 6 m h z . 4 t o 0 0 x e c t o 0 x e 8 i 2 c r c t [ 4 : 0 ] 0 c o n f i g u r e s t h e l e n g t h o f t h e i 2 c r e c e i v e d f i f o b u f f e r . t h e i 2 c p e r i p h e r a l s t o p s w h e n i 2 c r c t , b i t s [ 4 : 0 ] + 1 b y t e h a v e b e e n r e a d o r i f a n e r r o r o c c u r s . t a b l e 1 3 4 . i 2 c s l a v e a d d r e s s s f r ( i 2 c a d r , 0 x e 9 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 1 i 2 c s l v a d r 0 a d d r e s s o f t h e i 2 c s l a v e b e i n g a d d r e s s e d . w r i t i n g t o t h i s r e g i s t e r s t a r t s t h e i 2 c t r a n s m i s s i o n ( r e a d o r w r i t e ) . 0 i 2 c r _ w 0 c o m m a n d b i t f o r r e a d o r w r i t e . w h e n t h i s b i t i s s e t t o l o g i c 1 , a r e a d c o m m a n d i s t r a n s m i t t e d o n t h e i 2 c b u s . d a t a f r o m t h e s l a v e i n t h e s p i 2 c r x s f r i s e x p e c t e d a f t e r a c o m m a n d b y t e . w h e n t h i s b i t i s s e t t o l o g i c 0 , a w r i t e c o m m a n d i s t r a n s m i t t e d o n t h e i 2 c b u s . d a t a t o s l a v e i s e x p e c t e d i n t h e s p i 2 c t x s f r .
a d e 7 5 1 8 r e v . 0 | p a g e 1 1 9 o f 1 2 8 t a b l e 1 3 5 . i 2 c i n t e r r u p t s t a t u s r e g i s t e r s f r ( s p i 2 c s t a t , 0 x e a ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 i 2 c b u s y 0 t h i s b i t i s s e t t o l o g i c 1 w h e n t h e i 2 c i n t e r f a c e i s u s e d . w h e n t h i s b i t i s s e t , t h e t x f i f o i s e m p t i e d . 6 i 2 c n o a c k 0 i 2 c n o a c k n o w l e d g e m e n t t r a n s m i t i n t e r r u p t . t h i s b i t i s s e t t o l o g i c 1 w h e n t h e s l a v e d e v i c e d o e s n o t s e n d a n a c k n o w l e d g e m e n t . t h e i 2 c c o m m u n i c a t i o n i s s t o p p e d a f t e r t h i s e v e n t . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 5 i 2 c r x i r q 0 i 2 c r e c e i v e i n t e r r u p t . t h i s b i t i s s e t t o l o g i c 1 w h e n t h e r e c e i v e f i f o i s n o t e m p t y . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 4 i 2 c t x i r q 0 i 2 c t r a n s m i t i n t e r r u p t . t h i s b i t i s s e t t o l o g i c 1 w h e n t h e t r a n s m i t f i f o i s e m p t y . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 3 t o 2 i 2 c f i f o s t a t [ 1 : 0 ] 0 0 s t a t u s b i t s f o r 3 - o r 4 - b y t e d e e p i 2 c f i f o . t h e f i f o m o n i t o r e d i n t h e s e t w o b i t s i s t h e o n e c u r r e n t l y u s e d i n i 2 c c o m m u n i c a t i o n ( r e c e i v e o r t r a n s m i t ) b e c a u s e o n l y o n e f i f o i s a c t i v e a t a t i m e . i 2 c f i f o s t a t [ 1 : 0 ] r e s u l t 0 0 f i f o e m p t y 0 1 r e s e r v e d 1 0 f i f o h a l f f u l l 1 1 f i f o f u l l 1 i 2 c a c c _ e r r 0 s e t w h e n t r y i n g t o w r i t e a n d r e a d a t t h e s a m e t i m e . w r i t e a 0 t o t h i s b i t t o c l e a r i t . 0 i 2 c t x w r _ e r r 0 s e t w h e n w r i t e w a s a t t e m p t e d w h e n i 2 c t r a n s m i t f i f o w a s f u l l . w r i t e a 0 t o t h i s b i t t o c l e a r i t . r e a d a n d w r i t e o p e r a t i o n s s c l k s d a t a s t a r t b y m a s t e r a c k b y s l a v e a c k b y m a s t e r f r a m e 2 d a t a b y t e 1 f r o m m a s t e r f r a m e 1 s e r i a l b u s a d d r e s s b y t e 1 9 9 1 a 0 a 1 a 2 a 3 a 4 a 5 a 6 r / w d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 9 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 f r a m e n + 1 d a t a b y t e n f r o m s l a v e s t o p b y m a s t e r n a c k b y m a s t e r 0 7 3 2 7 - 0 9 8 f i g u r e 9 8 . i 2 c r e a d o p e r a t i o n s c l k s d a t a s t a r t b y m a s t e r a c k b y s l a v e a c k b y s l a v e f r a m e 2 d a t a b y t e 1 f r o m m a s t e r f r a m e 1 s e r i a l b u s a d d r e s s b y t e 1 9 9 1 s t o p b y m a s t e r a 0 a 1 a 2 a 3 a 4 a 5 a 6 r / w d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 0 7 3 2 7 - 0 9 9 f i g u r e 9 9 . i 2 c w r i t e o p e r a t i o n f i g u r e 9 8 a n d f i g u r e 9 9 d e p i c t i 2 c r e a d a n d w r i t e o p e r a t i o n s , r e s p e c t i v e l y . n o t e t h a t t h e l s b o f t h e i 2 c a d r r e g i s t e r i s u s e d t o s e l e c t w h e t h e r a r e a d o r w r i t e o p e r a t i o n i s p e r f o r m e d o n t h e s l a v e d e v i c e . d u r i n g t h e r e a d o p e r a t i o n , t h e m a s t e r a c k n o w l e d g e s a r e g e n e r a t e d a u t o m a t i c a l l y b y t h e i 2 c p e r i p h e r a l . t h e m a s t e r - g e n e r a t e d n a c k ( n o a c k n o w l e d g e ) b e f o r e t h e e n d o f a r e a d o p e r a t i o n i s a l s o a u t o m a t i c a l l y g e n e r a t e d a f t e r t h e i 2 c r c t , b i t s [ 4 : 0 ] h a v e b e e n r e a d f r o m t h e s l a v e . i f t h e i 2 c a d r r e g i s t e r i s u p d a t e d d u r i n g a t r a n s m i s s i o n , i n s t e a d o f g e n e r a t i n g a s t o p a t t h e e n d o f t h e r e a d o r w r i t e o p e r a t i o n , t h e m a s t e r g e n e r a t e s a s t a r t c o n d i t i o n a n d c o n t i n u e s w i t h t h e n e x t c o m m u n i c a t i o n . r e a d i n g t h e s p i / i 2 c r e c e i v e b u f f e r s f r ( s p i 2 c r x , 0 x 9 b ) r e a d i n g t h e s p i 2 c r x s f r s h o u l d b e d o n e w i t h a 2 - c y c l e i n s t r u c t i o n , s u c h a s m o v a , s p i 2 c r x o r m o v r 0 , s p i 2 c r x . a 3 - c y c l e i n s t r u c t i o n s u c h a s m o v 3 d h , s p i 2 c r x d o e s n o t t r a n s f e r t h e r i g h t d a t a i n t o r a m a d d r e s s 0 x 3 d .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 0 o f 1 2 8 i 2 c r e c e i v e a n d t r a n s m i t f i f o s t h e i 2 c p e r i p h e r a l h a s a 4 - b y t e r e c e i v e f i f o a n d a 4 - b y t e t r a n s m i t f i f o . t h e b u f f e r s r e d u c e t h e o v e r h e a d a s s o c i a t e d w i t h u s i n g t h e i 2 c p e r i p h e r a l . f i g u r e 1 0 0 s h o w s t h e o p e r a t i o n o f t h e i 2 c r e c e i v e a n d t r a n s m i t f i f o s . t h e t x f i f o c a n b e l o a d e d w i t h f o u r b y t e s t o b e t r a n s m i t t e d t o t h e s l a v e a t t h e b e g i n n i n g o f a w r i t e o p e r a t i o n . w h e n t h e t r a n s m i t f i f o i s e m p t y , t h e i 2 c t r a n s m i t i n t e r r u p t f l a g i s s e t , a n d t h e p c v e c t o r s t o t h e i 2 c i n t e r r u p t v e c t o r i f t h i s i n t e r r u p t i s e n a b l e d . i f a n e w b y t e i s n o t l o a d e d i n t o t h e t x f i f o b e f o r e i t i s n e e d e d i n t h e t r a n s m i t s h i f t r e g i s t e r , t h e c o m m u n i c a t i o n s t o p s . a n e r r o r , s u c h a s n o t r e c e i v i n g a n a c k n o w l e d g e , a l s o c a u s e s t h e c o m m u n i c a t i o n t o t e r m i n a t e . i n c a s e o f a n e r r o r d u r i n g a w r i t e o p e r a t i o n , t h e t x f i f o i s f l u s h e d . t h e r x f i f o a l l o w s f o u r b y t e s t o b e r e a d i n f r o m t h e s l a v e b e f o r e t h e m c u h a s t o r e a d t h e d a t a . a r e c e i v e i n t e r r u p t c a n b e g e n e r a t e d a f t e r e a c h b y t e i s r e c e i v e d o r w h e n t h e r x f i f o i s f u l l . i f t h e p e r i p h e r a l i s r e a d i n g f r o m a s l a v e a d d r e s s , t h e c o m m u n i c a t i o n s t o p s o n c e t h e n u m b e r o f r e c e i v e d b y t e s e q u a l s t h e n u m b e r s e t i n i 2 c r c t , b i t s [ 4 : 0 ] . a n e r r o r , s u c h a s n o t r e c e i v i n g a n a c k n o w l e d g e , a l s o c a u s e s t h e c o m m u n i c a t i o n t o t e r m i n a t e . i 2 c t x 4 - b y t e f i f o m o v i 2 c t x , t x d a t a 1 m o v i 2 c t x , t x d a t a 2 m o v i 2 c t x , t x d a t a 3 m o v i 2 c t x , t x d a t a 4 c o d e t o f i l l t x f i f o : t r a n s m i t s h i f t r e g i s t e r i 2 c r x r e c e i v e s h i f t r e g i s t e r 4 - b y t e f i f o c o d e t o r e a d r x f i f o : m o v a , i 2 c r x ; r e s u l t : a = r x d a t a 1 m o v a , i 2 c r x ; r e s u l t : a = r x d a t a 2 m o v a , i 2 c r x ; r e s u l t : a = r x d a t a 3 m o v a , i 2 c r x ; r e s u l t : a = r x d a t a 4 t x d a t a 1 t x d a t a 2 t x d a t a 3 t x d a t a 4 r x d a t a 4 r x d a t a 3 r x d a t a 2 r x d a t a 1 0 7 3 2 7 - 1 0 0 f i g u r e 1 0 0 . i 2 c f i f o o p e r a t i o n
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 1 o f 1 2 8 i / o p o r t s p a r a l l e l i / o t h e a d e 7 5 1 8 u s e s t h r e e i n p u t / o u t p u t p o r t s t o e x c h a n g e d a t a w i t h e x t e r n a l d e v i c e s . i n a d d i t i o n t o p e r f o r m i n g g e n e r a l - p u r p o s e i / o , s o m e a r e c a p a b l e o f d r i v i n g a n l c d o r p e r f o r m i n g a l t e r n a t e f u n c t i o n s f o r t h e p e r i p h e r a l s a v a i l a b l e o n - c h i p . i n g e n e r a l , w h e n a p e r i p h e r a l i s e n a b l e d , t h e p i n s a s s o c i a t e d w i t h i t c a n n o t b e u s e d a s a g e n e r a l - p u r p o s e i / o . t h e i / o p o r t c a n b e c o n f i g u r e d t h r o u g h t h e s f r s l i s t e d i n t a b l e 1 3 6 . t a b l e 1 3 6 . i / o p o r t s f r s s f r a d d r e s s b i t a d d r e s s a b l e d e s c r i p t i o n p 0 0 x 8 0 y e s p o r t 0 . p 1 0 x 9 0 y e s p o r t 1 . p 2 0 x a 0 y e s p o r t 2 . e p c f g 0 x 9 f n o e x t e n d e d p o r t c o n f i g u r a t i o n . p i n m a p 0 0 x b 2 n o p o r t 0 w e a k p u l l - u p e n a b l e . p i n m a p 1 0 x b 3 n o p o r t 1 w e a k p u l l - u p e n a b l e . p i n m a p 2 0 x b 4 n o p o r t 2 w e a k p u l l - u p e n a b l e . t h e t h r e e b i d i r e c t i o n a l i / o p o r t s h a v e i n t e r n a l p u l l - u p s t h a t c a n b e e n a b l e d o r d i s a b l e d i n d i v i d u a l l y f o r e a c h p i n . t h e i n t e r n a l p u l l - u p s a r e e n a b l e d b y d e f a u l t . d i s a b l i n g a n i n t e r n a l p u l l - u p c a u s e s a p i n t o b e c o m e o p e n d r a i n . w e a k i n t e r n a l p u l l - u p s a r e c o n f i g u r e d t h r o u g h t h e p i n m a p x s f r s . f i g u r e 1 0 1 s h o w s a t y p i c a l b i t l a t c h a n d i / o b u f f e r f o r a n i / o p i n . t h e b i t l a t c h ( o n e b i t i n e a c h p o r t ? s s f r ) i s r e p r e s e n t e d a s a t y p e d f l i p - f l o p , w h i c h c l o c k s i n a v a l u e f r o m t h e i n t e r n a l b u s i n r e s p o n s e t o a w r i t e - t o - l a t c h s i g n a l f r o m t h e c p u . t h e q o u t p u t o f t h e f l i p - f l o p i s p l a c e d o n t h e i n t e r n a l b u s i n r e s p o n s e t o a r e a d l a t c h s i g n a l f r o m t h e c p u . t h e l e v e l o f t h e p o r t p i n i t s e l f i s p l a c e d o n t h e i n t e r n a l b u s i n r e s p o n s e t o a r e a d p i n s i g n a l f r o m t h e c p u . s o m e i n s t r u c t i o n s t h a t r e a d a p o r t a c t i v a t e t h e r e a d l a t c h s i g n a l , a n d o t h e r s a c t i v a t e t h e r e a d p i n s i g n a l . s e e t h e r e a d - m o d i f y - w r i t e i n s t r u c t i o n s s e c t i o n f o r d e t a i l s . r e a d l a t c h i n t e r n a l b u s w r i t e t o l a t c h r e a d p i n d c l q l a t c h d v d d p x . x p i n i n t e r n a l p u l l - u p a l t e r n a t e o u t p u t f u n c t i o n a l t e r n a t e i n p u t f u n c t i o n q c l o s e d : p i n m a p x . x = 0 o p e n : p i n m a p x . x = 1 0 7 3 2 7 - 1 0 1 f i g u r e 1 0 1 . p o r t 0 b i t l a t c h a n d i / o b u f f e r w e a k i n t e r n a l p u l l - u p s e n a b l e d a p i n w i t h w e a k i n t e r n a l p u l l - u p e n a b l e d i s u s e d a s a n i n p u t b y w r i t i n g a 1 t o t h e p i n . t h e p i n i s p u l l e d h i g h b y t h e i n t e r n a l p u l l - u p s , a n d t h e p i n i s r e a d u s i n g t h e c i r c u i t r y s h o w n i n f i g u r e 1 0 1 . i f t h e p i n i s d r i v e n l o w e x t e r n a l l y , i t s o u r c e s c u r r e n t b e c a u s e o f t h e i n t e r n a l p u l l - u p s . a p i n w i t h i n t e r n a l p u l l - u p e n a b l e d i s u s e d a s a n o u t p u t b y w r i t i n g a 1 o r a 0 t o t h e p i n t o c o n t r o l t h e l e v e l o f t h e o u t p u t . i f a 0 i s w r i t t e n t o t h e p i n , i t d r i v e s a l o g i c l o w o u t p u t v o l t a g e ( v o l ) a n d i s c a p a b l e o f s i n k i n g 1 . 6 m a . o p e n d r a i n ( w e a k i n t e r n a l p u l l - u p s d i s a b l e d ) w h e n t h e w e a k i n t e r n a l p u l l - u p o n a p i n i s d i s a b l e d , t h e p i n b e c o m e s o p e n d r a i n . u s e t h i s o p e n - d r a i n p i n a s a h i g h i m p e d a n c e i n p u t b y w r i t i n g a 1 t o t h e p i n . t h e p i n i s r e a d u s i n g t h e c i r c u i t r y s h o w n i n f i g u r e 1 0 1 . t h e o p e n - d r a i n o p t i o n i s p r e f e r a b l e f o r i n p u t s b e c a u s e i t d r a w s l e s s c u r r e n t t h a n t h e i n t e r n a l p u l l - u p s t h a t w e r e e n a b l e d . 3 8 k h z m o d u l a t i o n t h e a d e 7 5 1 8 p r o v i d e s a 3 8 k h z m o d u l a t i o n s i g n a l . t h e 3 8 k h z m o d u l a t i o n i s a c c o m p l i s h e d b y i n t e r n a l l y x o r ? i n g t h e l e v e l w r i t t e n t o t h e i / o p i n w i t h a 3 8 k h z s q u a r e w a v e . t h e n , w h e n a 0 i s w r i t t e n t o t h e i / o p i n , i t i s m o d u l a t e d a s s h o w n i n f i g u r e 1 0 2 . 3 8 k h z m o d u l a t i o n s i g n a l 3 8 k h z m o d u l a t e d o u t p u t p i n l e v e l w r i t t e n t o m o d 3 8 0 7 3 2 7 - 1 0 2 f i g u r e 1 0 2 . 3 8 k h z m o d u l a t i o n u s e s f o r t h i s 3 8 k h z m o d u l a t i o n i n c l u d e i r m o d u l a t i o n o f a u a r t t r a n s m i t s i g n a l o r a l o w p o w e r s i g n a l t o d r i v e a n l e d . t h e m o d u l a t i o n c a n b e e n a b l e d o r d i s a b l e d w i t h t h e m o d 3 8 e n b i t i n t h e c f g s f r . t h e 3 8 k h z m o d u l a t i o n i s a v a i l a b l e o n e i g h t p i n s , s e l e c t e d b y t h e m o d 3 8 [ 7 : 0 ] b i t s i n t h e e x t e n d e d p o r t c o n f i g u r a t i o n s f r ( e p c f g , 0 x 9 f ) .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 2 o f 1 2 8 i / o r e g i s t e r s t a b l e 1 3 7 . e x t e n d e d p o r t c o n f i g u r a t i o n s f r ( e p c f g , 0 x 9 f ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 m o d 3 8 _ f p 2 1 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 1 . 6 / f p 2 1 p i n . 6 m o d 3 8 _ f p 2 2 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 1 . 5 / f p 2 2 p i n . 5 m o d 3 8 _ f p 2 3 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 1 . 4 / t 2 / f p 2 3 p i n . 4 m o d 3 8 _ t x d 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 1 . 1 / t x d p i n . 3 m o d 3 8 _ c f 1 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 0 . 2 / c f 1 / r t c c a l p i n . 2 m o d 3 8 _ s s b 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 0 . 7 / s s / t 1 p i n . 1 m o d 3 8 _ m i s o 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 0 . 5 / m i s o p i n . 0 m o d 3 8 _ c f 2 0 e n a b l e 3 8 k h z m o d u l a t i o n o n p 0 . 3 / c f 2 p i n . t a b l e 1 3 8 . p o r t 0 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 0 , 0 x b 2 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 p i n m a p 0 . 7 0 t h e w e a k p u l l - u p o n p 0 . 7 i s d i s a b l e d w h e n t h i s b i t i s s e t . 6 p i n m a p 0 . 6 0 t h e w e a k p u l l - u p o n p 0 . 6 i s d i s a b l e d w h e n t h i s b i t i s s e t . 5 p i n m a p 0 . 5 0 t h e w e a k p u l l - u p o n p 0 . 5 i s d i s a b l e d w h e n t h i s b i t i s s e t . 4 p i n m a p 0 . 4 0 t h e w e a k p u l l - u p o n p 0 . 4 i s d i s a b l e d w h e n t h i s b i t i s s e t . 3 p i n m a p 0 . 3 0 t h e w e a k p u l l - u p o n p 0 . 3 i s d i s a b l e d w h e n t h i s b i t i s s e t . 2 p i n m a p 0 . 2 0 t h e w e a k p u l l - u p o n p 0 . 2 i s d i s a b l e d w h e n t h i s b i t i s s e t . 1 p i n m a p 0 . 1 0 t h e w e a k p u l l - u p o n p 0 . 1 i s d i s a b l e d w h e n t h i s b i t i s s e t . 0 p i n m a p 0 . 0 0 t h e w e a k p u l l - u p o n p 0 . 0 i s d i s a b l e d w h e n t h i s b i t i s s e t . t a b l e 1 3 9 . p o r t 1 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 1 , 0 x b 3 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 p i n m a p 1 . 7 0 t h e w e a k p u l l - u p o n p 1 . 7 i s d i s a b l e d w h e n t h i s b i t i s s e t . 6 p i n m a p 1 . 6 0 t h e w e a k p u l l - u p o n p 1 . 6 i s d i s a b l e d w h e n t h i s b i t i s s e t . 5 p i n m a p 1 . 5 0 t h e w e a k p u l l - u p o n p 1 . 5 i s d i s a b l e d w h e n t h i s b i t i s s e t . 4 p i n m a p 1 . 4 0 t h e w e a k p u l l - u p o n p 1 . 4 i s d i s a b l e d w h e n t h i s b i t i s s e t . 3 p i n m a p 1 . 3 0 t h e w e a k p u l l - u p o n p 1 . 3 i s d i s a b l e d w h e n t h i s b i t i s s e t . 2 p i n m a p 1 . 2 0 t h e w e a k p u l l - u p o n p 1 . 2 i s d i s a b l e d w h e n t h i s b i t i s s e t . 1 p i n m a p 1 . 1 0 t h e w e a k p u l l - u p o n p 1 . 1 i s d i s a b l e d w h e n t h i s b i t i s s e t . 0 p i n m a p 1 . 0 0 t h e w e a k p u l l - u p o n p 1 . 0 i s d i s a b l e d w h e n t h i s b i t i s s e t . t a b l e 1 4 0 . p o r t 2 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 2 , 0 x b 4 ) b i t m n e m o n i c d e f a u l t d e s c r i p t i o n 7 t o 6 r e s e r v e d 0 r e s e r v e d . s h o u l d b e l e f t c l e a r e d . 5 p i n m a p 2 . 5 0 t h e w e a k p u l l - u p o n r e s e t i s d i s a b l e d w h e n t h i s b i t i s s e t . 4 r e s e r v e d 0 r e s e r v e d . s h o u l d b e l e f t c l e a r e d . 3 p i n m a p 2 . 3 0 r e s e r v e d . s h o u l d b e l e f t c l e a r e d . 2 p i n m a p 2 . 2 0 t h e w e a k p u l l - u p o n p 2 . 2 i s d i s a b l e d w h e n t h i s b i t i s s e t . 1 p i n m a p 2 . 1 0 t h e w e a k p u l l - u p o n p 2 . 1 i s d i s a b l e d w h e n t h i s b i t i s s e t . 0 p i n m a p 2 . 0 0 t h e w e a k p u l l - u p o n p 2 . 0 i s d i s a b l e d w h e n t h i s b i t i s s e t .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 3 o f 1 2 8 t a b l e 1 4 1 . p o r t 0 s f r ( p 0 , 0 x 8 0 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 1 7 0 x 8 7 t 1 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 7 / s s / t 1 p i n . i t c a n b e w r i t t e n o r r e a d . 6 0 x 8 6 t 0 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 6 / s c l k / t 0 p i n . i t c a n b e w r i t t e n o r r e a d . 5 0 x 8 5 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 5 / m i s o p i n . i t c a n b e w r i t t e n o r r e a d . 4 0 x 8 4 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 4 / m o s i / s d a t a p i n . i t c a n b e w r i t t e n o r r e a d . 3 0 x 8 3 c f 2 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 3 / c f 2 p i n . i t c a n b e w r i t t e n o r r e a d . 2 0 x 8 2 c f 1 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 2 / c f 1 / r t c c a l p i n . i t c a n b e w r i t t e n o r r e a d . 1 0 x 8 1 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 0 . 1 / f p 1 9 p i n . i t c a n b e w r i t t e n o r r e a d . 0 0 x 8 0 i n t 1 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e b c t r l / i n t 1 / p 0 . 0 p i n . i t c a n b e w r i t t e n o r r e a d . 1 w h e n a n a l t e r n a t e f u n c t i o n i s c h o s e n f o r a p i n o f t h i s p o r t , t h e b i t c o n t r o l l i n g t h i s p i n s h o u l d a l w a y s b e s e t . t a b l e 1 4 2 . p o r t 1 s f r ( p 1 , 0 x 9 0 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 1 7 0 x 9 7 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 7 / f p 2 0 p i n . i t c a n b e w r i t t e n o r r e a d . 6 0 x 9 6 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 6 / f p 2 1 p i n . i t c a n b e w r i t t e n o r r e a d . 5 0 x 9 5 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 5 / f p 2 2 p i n . i t c a n b e w r i t t e n o r r e a d . 4 0 x 9 4 t 2 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 4 / t 2 / f p 2 3 p i n . i t c a n b e w r i t t e n o r r e a d . 3 0 x 9 3 t 2 e x 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 3 / t 2 e x / f p 2 4 p i n . i t c a n b e w r i t t e n o r r e a d . 2 0 x 9 2 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 2 / f p 2 5 p i n . i t c a n b e w r i t t e n o r r e a d . 1 0 x 9 1 t x d 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 1 / t x d p i n . i t c a n b e w r i t t e n o r r e a d . 0 0 x 9 0 r x d 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 1 . 0 / r x d p i n . i t c a n b e w r i t t e n o r r e a d . 1 w h e n a n a l t e r n a t e f u n c t i o n i s c h o s e n f o r a p i n o f t h i s p o r t , t h e b i t c o n t r o l l i n g t h i s p i n s h o u l d a l w a y s b e s e t . t a b l e 1 4 3 . p o r t 2 s f r ( p 2 , 0 x a 0 ) b i t a d d r e s s m n e m o n i c d e f a u l t d e s c r i p t i o n 1 7 t o 4 0 x 9 7 t o 0 x 9 4 0 x 1 f t h e s e b i t s a r e u n u s e d a n d s h o u l d r e m a i n s e t . 3 0 x 9 3 p 2 . 3 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e s d e n / p 2 . 3 p i n . i t c a n b e w r i t t e n o n l y . 2 0 x 9 2 p 2 . 2 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 2 . 2 / f p 1 6 p i n . i t c a n b e w r i t t e n o r r e a d . 1 0 x 9 1 p 2 . 1 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 2 . 1 / f p 1 7 p i n . i t c a n b e w r i t t e n o r r e a d . 0 0 x 9 0 p 2 . 0 1 t h i s b i t r e f l e c t s t h e s t a t e o f t h e p 2 . 0 / f p 1 8 p i n . i t c a n b e w r i t t e n o r r e a d . 1 w h e n a n a l t e r n a t e f u n c t i o n i s c h o s e n f o r a p i n o f t h i s p o r t , t h e b i t c o n t r o l l i n g t h i s p i n s h o u l d a l w a y s b e s e t .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 4 o f 1 2 8 t a b l e 1 4 4 . p o r t 0 a l t e r n a t e f u n c t i o n s p i n n o . a l t e r n a t e f u n c t i o n a l t e r n a t e f u n c t i o n e n a b l e p 0 . 0 b c t r l e x t e r n a l b a t t e r y c o n t r o l i n p u t s e t i n t 1 p r g [ 2 : 0 ] = x 0 1 i n t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) . i n t 1 e x t e r n a l i n t e r r u p t s e t e x 1 i n t h e i n t e r r u p t e n a b l e s f r ( i e , 0 x a 8 ) . i n t 1 w a k e - u p f r o m p s m 2 o p e r a t i n g m o d e s e t i n t 1 p r g [ 2 : 0 ] = 1 1 x i n t h e i n t e r r u p t p i n s c o n f i g u r a t i o n s f r ( i n t p r , 0 x f f ) . p 0 . 1 f p 1 9 l c d s e g m e n t p i n s e t f p 1 9 e n i n t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . p 0 . 2 c f 1 a d e c a l i b r a t i o n f r e q u e n c y o u t p u t c l e a r t h e d i s c f 1 b i t i n t h e a d e e n e r g y m e a s u r e m e n t i n t e r n a l m o d e 1 r e g i s t e r ( 0 x 0 b ) . p 0 . 3 c f 2 a d e c a l i b r a t i o n f r e q u e n c y o u t p u t c l e a r t h e d i s c f 2 b i t i n t h e a d e e n e r g y m e a s u r e m e n t i n t e r n a l m o d e 1 r e g i s t e r ( 0 x 0 b ) . p 0 . 4 m o s i s p i d a t a l i n e s e t t h e s c p s b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) a n d s e t t h e s p i e n b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . s d a t a i 2 c d a t a l i n e c l e a r t h e s c p s b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) a n d s e t t h e i 2 c e n b i t i n t h e i 2 c m o d e s f r ( i 2 c m o d , 0 x e 8 ) . p 0 . 5 m i s o s p i d a t a l i n e s e t t h e s c p s b i t i n t h e c o n f i g u r a t i o n s f r ( c f g , 0 x a f ) a n d s e t t h e s p i e n b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . p 0 . 6 s c l k s e r i a l c l o c k f o r i 2 c o r s p i s e t t h e i 2 c e n b i t i n t h e i 2 c m o d e s f r ( i 2 c m o d , 0 x e 8 ) o r t h e s p i e n b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) t o e n a b l e t h e i 2 c o r s p i i n t e r f a c e . t 0 t i m e r 0 i n p u t s e t t h e c / t 0 b i t i n t h e t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 m o d e s f r ( t m o d , 0 x 8 9 ) t o e n a b l e t 0 a s a n e x t e r n a l e v e n t c o u n t e r . p 0 . 7 s s s p i s l a v e s e l e c t i n p u t f o r s p i i n s l a v e m o d e s e t t h e s s _ e n b i t i n t h e s p i c o n f i g u r a t i o n s f r 1 ( s p i m o d 1 , 0 x e 8 ) . s s s p i s l a v e s e l e c t o u t p u t f o r s p i i n m a s t e r m o d e s e t t h e s p i m s _ b b i t i n t h e s p i c o n f i g u r a t i o n s f r 2 ( s p i m o d 2 , 0 x e 9 ) . t 1 t i m e r 1 i n p u t s e t t h e c / t 1 b i t i n t h e t i m e r / c o u n t e r 0 a n d t i m e r / c o u n t e r 1 m o d e s f r ( t m o d , 0 x 8 9 ) t o e n a b l e t 1 a s a n e x t e r n a l e v e n t c o u n t e r . t a b l e 1 4 5 . p o r t 1 a l t e r n a t e f u n c t i o n s p i n n o . a l t e r n a t e f u n c t i o n a l t e r n a t e f u n c t i o n e n a b l e p 1 . 0 r x d r e c e i v e r d a t a i n p u t f o r u a r t s e t t h e r e n b i t i n t h e s e r i a l c o m m u n i c a t i o n s c o n t r o l r e g i s t e r s f r ( s c o n , 0 x 9 8 ) . r x e d g e w a k e - u p f r o m p s m 2 o p e r a t i n g m o d e s e t r x p r o g [ 1 : 0 ] = 1 1 i n t h e p e r i p h e r a l c o n f i g u r a t i o n s f r ( p e r i p h , 0 x f 4 ) . p 1 . 1 t x d t r a n s m i t t e r d a t a o u t p u t f o r u a r t t h i s p i n b e c o m e s t x d a s s o o n a s d a t a i s w r i t t e n i n t o s b u f . p 1 . 2 f p 2 5 l c d s e g m e n t p i n s e t f p 2 5 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . p 1 . 3 f p 2 4 l c d s e g m e n t p i n s e t f p 2 4 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . t 2 e x t i m e r 2 c o n t r o l i n p u t s e t e x e n 2 i n t h e t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) . p 1 . 4 f p 2 3 l c d s e g m e n t p i n s e t f p 2 3 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . t 2 t i m e r 2 i n p u t s e t t h e c / t 2 b i t i n t h e t i m e r / c o u n t e r 2 c o n t r o l s f r ( t 2 c o n , 0 x c 8 ) t o e n a b l e t 2 a s a n e x t e r n a l e v e n t c o u n t e r . p 1 . 5 f p 2 2 l c d s e g m e n t p i n s e t f p 2 2 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . p 1 . 6 f p 2 1 l c d s e g m e n t p i n s e t f p 2 1 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . p 1 . 7 f p 2 0 l c d s e g m e n t p i n s e t f p 2 0 e n i n t h e l c d s e g m e n t e n a b l e s f r ( l c d s e g e , 0 x 9 7 ) . t a b l e 1 4 6 . p o r t 2 a l t e r n a t e f u n c t i o n s p i n n o . a l t e r n a t e f u n c t i o n a l t e r n a t e f u n c t i o n e n a b l e p 2 . 0 f p 1 8 l c d s e g m e n t p i n s e t f p 1 8 e n i n t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . p 2 . 1 f p 1 7 l c d s e g m e n t p i n s e t f p 1 7 e n i n t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . p 2 . 2 f p 1 6 l c d s e g m e n t p i n s e t f p 1 6 e n i n t h e l c d s e g m e n t e n a b l e 2 s f r ( l c d s e g e 2 , 0 x e d ) . p 2 . 3 s d e n s e r i a l d o w n l o a d p i n s a m p l e d o n r e s e t . p 2 . 3 i s a n o u t p u t o n l y . e n a b l e d b y d e f a u l t .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 5 o f 1 2 8 p o r t 0 p o r t 0 i s c o n t r o l l e d d i r e c t l y t h r o u g h t h e b i t - a d d r e s s a b l e p o r t 0 s f r ( p 0 , 0 x 8 0 ) . t h e w e a k i n t e r n a l p u l l - u p s f o r p o r t 0 a r e c o n f i - g u r e d t h r o u g h t h e p o r t 0 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 0 , 0 x b 2 ) ; t h e y a r e e n a b l e d b y d e f a u l t . t h e w e a k i n t e r n a l p u l l - u p i s d i s a b l e d b y w r i t i n g a 1 t o p i n m a p 0 . x . p o r t 0 p i n s a l s o h a v e v a r i o u s s e c o n d a r y f u n c t i o n s a s d e s c r i b e d i n t a b l e 1 4 4 . t h e a l t e r n a t e f u n c t i o n s o f p o r t 0 p i n s c a n b e a c t i v a t e d o n l y i f t h e c o r r e s p o n d i n g b i t l a t c h i n t h e p o r t 0 s f r c o n t a i n s a 1 . o t h e r w i s e , t h e p o r t p i n r e m a i n s a t 0 . p o r t 1 p o r t 1 i s a n 8 - b i t b i d i r e c t i o n a l p o r t c o n t r o l l e d d i r e c t l y t h r o u g h t h e b i t - a d d r e s s a b l e p o r t 1 s f r ( p 1 , 0 x 9 0 ) . t h e w e a k i n t e r n a l p u l l - u p s f o r p o r t 1 a r e c o n f i g u r e d t h r o u g h t h e p o r t 1 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 1 , 0 x b 3 ) ; t h e y a r e e n a b l e d b y d e f a u l t . t h e w e a k i n t e r n a l p u l l - u p i s d i s a b l e d b y w r i t i n g a 1 t o p i n m a p 1 . x . p o r t 1 p i n s a l s o h a v e v a r i o u s s e c o n d a r y f u n c t i o n s a s d e s c r i b e d i n t a b l e 1 4 5 . t h e a l t e r n a t e f u n c t i o n s o f p o r t 1 p i n s c a n b e a c t i v a t e d o n l y i f t h e c o r r e s p o n d i n g b i t l a t c h i n t h e p o r t 1 s f r c o n t a i n s a 1 . o t h e r w i s e , t h e p o r t p i n r e m a i n s a t 0 . p o r t 2 p o r t 2 i s a 4 - b i t b i d i r e c t i o n a l p o r t c o n t r o l l e d d i r e c t l y t h r o u g h t h e b i t - a d d r e s s a b l e p o r t 2 s f r ( p 2 , 0 x a 0 ) . n o t e t h a t p 2 . 3 c a n b e u s e d a s a n o u t p u t o n l y . c o n s e q u e n t l y , a n y r e a d o p e r a t i o n , s u c h a s a c p l p 2 . 3 , c a n n o t b e e x e c u t e d o n t h i s i / o . t h e w e a k i n t e r n a l p u l l - u p s f o r p o r t 2 a r e c o n f i g u r e d t h r o u g h t h e p o r t 2 w e a k p u l l - u p e n a b l e s f r ( p i n m a p 2 , 0 x b 4 ) ; t h e y a r e e n a b l e d b y d e f a u l t . t h e w e a k i n t e r n a l p u l l - u p i s d i s a b l e d b y w r i t i n g a 1 t o p i n m a p 2 . x . p o r t 2 p i n s a l s o h a v e v a r i o u s s e c o n d a r y f u n c t i o n s a s d e s c r i b e d i n t a b l e 1 4 6 . t h e a l t e r n a t e f u n c t i o n s o f p o r t 2 p i n s c a n b e a c t i v a t e d o n l y i f t h e c o r r e s p o n d i n g b i t l a t c h i n t h e p o r t 2 s f r c o n t a i n s a 1 . o t h e r w i s e , t h e p o r t p i n r e m a i n s a t 0 .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 6 o f 1 2 8 d e t e r m i n i n g t h e v e r s i o n o f t h e a d e 7 5 1 8 t h e a d e 7 5 1 8 h o l d s i n i t s i n t e r n a l f l a s h r e g i s t e r s a v a l u e t h a t d e f i n e s i t s v e r s i o n . t h i s v a l u e h e l p s t o d e t e r m i n e i f u s e r s h a v e t h e l a t e s t v e r s i o n o f t h e p a r t . t h e a d e 7 5 1 8 v e r s i o n c o r r e s p o n d i n g t o t h i s d a t a s h e e t i s a d e 7 5 1 8 v 3 . 4 . t o a c c e s s t h i s v a l u e , t h e f o l l o w i n g p r o c e d u r e c a n b e f o l l o w e d : 1 . l a u n c h h y p e r t e r m i n a l w i t h a 9 6 0 0 b a u d r a t e . 2 . p u t t h e p a r t i n s e r i a l d o w n l o a d m o d e b y f i r s t h o l d i n g s d e n t o l o g i c l o w a n d t h e n r e s e t t i n g t h e p a r t . 3 . h o l d t h e s d e n p i n . 4 . p r e s s a n d r e l e a s e t h e r e s e t p i n . 5 . t h e f o l l o w i n g s t r i n g s h o u l d a p p e a r o n t h e h y p e r t e r m i n a l s c r e e n : a d e 7 5 1 8 v 3 . 4
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 7 o f 1 2 8 o u t l i n e d i m e n s i o n s c o m p l i a n t t o j e d e c s t a n d a r d s m s - 0 2 6 - b c d 0 5 1 7 0 6 - a t o p v i e w ( p i n s d o w n ) 1 1 6 1 7 3 3 3 2 4 8 4 9 6 4 0 . 2 7 0 . 2 2 0 . 1 7 0 . 5 0 b s c l e a d p i t c h 1 2 . 2 0 1 2 . 0 0 s q 1 1 . 8 0 p i n 1 1 . 6 0 m a x 0 . 7 5 0 . 6 0 0 . 4 5 1 0 . 2 0 1 0 . 0 0 s q 9 . 8 0 v i e w a 0 . 2 0 0 . 0 9 1 . 4 5 1 . 4 0 1 . 3 5 0 . 0 8 c o p l a n a r i t y v i e w a r o t a t e d 9 0 c c w s e a t i n g p l a n e 0 . 1 5 0 . 0 5 7 3 . 5 0 f i g u r e 1 0 3 . 6 4 - l e a d l o w p r o f i l e q u a d f l a t p a c k a g e [ l q f p ] ( s t - 6 4 - 2 ) d i m e n s i o n s s h o w n i n m i l l i m e t e r s o r d e r i n g g u i d e m o d e l a n t i t a m p e r d i / d t s e n s o r i n t e r f a c e v a r f l a s h ( k b ) t e m p e r a t u r e r a n g e p a c k a g e d e s c r i p t i o n p a c k a g e o p t i o n a d e 7 5 1 8 a s t z f 8 1 n o n o y e s 8 ? 4 0 c t o + 8 5 c 6 4 - l e a d l q f p s t - 6 4 - 2 a d e 7 5 1 8 a s t z f 8 - r l 1 n o n o y e s 8 ? 4 0 c t o + 8 5 c 6 4 - l e a d l q f p , r e e l s t - 6 4 - 2 a d e 7 5 1 8 a s t z f 1 6 1 n o n o y e s 1 6 ? 4 0 c t o + 8 5 c 6 4 - l e a d l q f p s t - 6 4 - 2 a d e 7 5 1 8 a s t z f 1 6 - r l 1 n o n o y e s 1 6 ? 4 0 c t o + 8 5 c 6 4 - l e a d l q f p , r e e l s t - 6 4 - 2 1 z = r o h s c o m p l i a n t p a r t .
a d e 7 5 1 8 r e v . 0 | p a g e 1 2 8 o f 1 2 8 n o t e s p u r c h a s e o f l i c e n s e d i 2 c c o m p o n e n t s o f a n a l o g d e v i c e s o r o n e o f i t s s u b l i c e n s e d a s s o c i a t e d c o m p a n i e s c o n v e y s a l i c e n s e f o r t h e p u r c h a s e r u n d e r t h e p h i l i p s i 2 c p a t e n t r i g h t s t o u s e t h e s e c o m p o n e n t s i n a n i 2 c s y s t e m , p r o v i d e d t h a t t h e s y s t e m c o n f o r m s t o t h e i 2 c s t a n d a r d s p e c i f i c a t i o n a s d e f i n e d b y p h i l i p s . ? 2 0 0  a n a l o g d e v i c e s , i n c . a l l r i g h t s r e s e r v e d . t r a d e m a r k s a n d r e g i s t e r e d t r a d e m a r k s a r e t h e p r o p e r t y o f t h e i r r e s p e c t i v e o w n e r s . d 0 7 3 2 7 - 0 -  / 0  ( 0 )


▲Up To Search▲   

 
Price & Availability of ADE7518

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X